99 branches : [ master ]
1010 workflow_dispatch :
1111
12+ env :
13+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
14+
15+ # Prevents multiple runs from clashing, but allows tags to finish
16+ concurrency :
17+ group : ${{ github.workflow }}-${{ github.ref }}
18+ cancel-in-progress : false
19+
1220jobs :
1321 setup :
1422 name : Setup environment
4149 test :
4250 name : Test
4351 needs : setup
52+ # Only run tests on PRs or Master pushes (not on tags to save time)
53+ if : github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))
4454 runs-on : ubuntu-latest
4555 steps :
4656 - uses : actions/checkout@v4
@@ -83,44 +93,36 @@ jobs:
8393 name : Test release
8494 needs : test
8595 runs-on : ubuntu-latest
86- # This prevents the "Test release" from running on tag pushes,
87- # saving minutes of CI time since you already tested before pushing the tag.
88- if : github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))
8996 strategy :
9097 matrix :
9198 preview : ['preact', 'vanilla', 'uhtml', 'svelte']
92-
9399 steps :
94100 - uses : actions/checkout@v4
95101 - uses : actions/setup-node@v4
96102 with :
97103 node-version-file : .nvmrc
98-
99104 - name : Load node_modules from cache
100105 uses : actions/cache@v4
101106 with :
102107 path : |
103108 node_modules
104109 */*/node_modules
105110 key : ${{ runner.os }}-node_modules-${{ hashFiles('**/package.json') }}-${{ hashFiles('package.json') }}
106-
107111 - name : Load libs from cache
108112 uses : actions/cache@v4
109113 with :
110114 path : packages/*/lib
111115 key : ${{ runner.os }}-lib-${{ github.sha }}
112-
113116 - name : Restore workspaces
114117 run : npm ci
115-
116118 - name : Test release ${{ matrix.preview }}
117119 run : npm run test:release -- ${{ matrix.preview }}
118120
119121 publish :
120- # This triggers ONLY when you push the tags via `npm run release`
121- if : startsWith(github.ref, 'refs/tags/@merkur/')
122122 name : Publish to npm
123- # Note: Removed "needs: release" so that publishing starts immediately on tag push
123+ # Use 'contains' for better ref matching on tag pushes
124+ if : github.event_name == 'push' && contains(github.ref, 'refs/tags/@merkur/')
125+ needs : setup
124126 runs-on : ubuntu-latest
125127 env :
126128 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
@@ -157,8 +159,8 @@ jobs:
157159
158160 - name : Extract Latest Root Changelog
159161 run : |
160- # Grabs everything from the first ## to the next ## (the latest release block)
161- sed -n '/^## /,/## /p' CHANGELOG.md | sed '$d' > current-changelog.txt
162+ # Robust extraction of the first version block from root CHANGELOG
163+ sed -n '/^## /,/^ ## /p' CHANGELOG.md | sed '$d' > current-changelog.txt
162164
163165 - name : Create GitHub Release
164166 uses : softprops/action-gh-release@v1
@@ -169,7 +171,8 @@ jobs:
169171
170172 deploy :
171173 name : Deploy to GitHub Pages
172- needs : test
174+ # Depends on setup and test (implicitly via build results)
175+ needs : [setup, test]
173176 runs-on : ubuntu-latest
174177 if : github.ref == 'refs/heads/master' && github.event_name == 'push'
175178 permissions :
0 commit comments