Repository navigation
132 lines (122 loc) · 3.96 KB
/
Copy pathpush.yml
File metadata and controls
132 lines (122 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Push
on:
push:
branches: ['**']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
contents: read
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v3
with:
cache: true
require-lockfile: true
- run: pnpm format:check
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm build
test:
name: Test (Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
# Report every version, so a failure on one doesn't hide the state of the others
fail-fast: false
matrix:
# The minimum from packages/maple's engines field, then every newer even release
node: [22, 24, 26]
steps:
- uses: actions/checkout@v7
- uses: pnpm/setup@v3
with:
runtime: node@${{ matrix.node }}
cache: true
require-lockfile: true
- run: node --version
- run: pnpm test
release:
name: Release
needs: [check, test]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write # push release commit + tag, create GitHub release
issues: write # comment on released issues
pull-requests: write # comment on released PRs
id-token: write # npm trusted publishing (OIDC) + provenance
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- uses: pnpm/setup@v3
with:
cache: true
require-lockfile: true
- run: pnpm --filter @netwin/maple build
# Trusted publishing needs npm >= 11.5.1;
- run: pnpm add --global npm@^11 && npm --version
- uses: cycjimmy/semantic-release-action@v8
with:
semantic_version: 25
extra_plugins: |
@semantic-release/changelog@7
@semantic-release/git@11
conventional-changelog-conventionalcommits@9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publishes the playground to https://netwin.github.io/maple/. It runs after the release
pages:
name: Deploy playground
needs: [release]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write # upload the site
id-token: write # prove the deployment comes from this workflow
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
with:
ref: master
- uses: pnpm/setup@v3
with:
cache: true
require-lockfile: true
# Pages serves the site below /maple/, so every URL the app builds must start there
- run: pnpm --filter @netwin/maple-playground build --base-href /maple/
- uses: actions/upload-pages-artifact@v5
with:
path: apps/maple-playground/dist/maple-playground/browser
- id: deployment
uses: actions/deploy-pages@v5
# Brings the release commit and tag back to increment, where pull requests branch off, so their
# changelog preview starts from the latest release
sync:
name: Sync increment
needs: [release]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write # push to increment
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
ref: increment
# Fast-forwards when increment has nothing new; otherwise the merge commit is not a Conventional
# Commit, so it stays out of the next changelog. A conflict fails the job and leaves increment
# as it was.
- run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git merge --no-edit origin/master
git push origin increment