22
33on :
44 push :
5- branches : ["main "]
5+ branches : ["** "]
66 pull_request :
77 branches : ["main"]
88
@@ -13,176 +13,58 @@ concurrency:
1313permissions :
1414 contents : read
1515
16+ env :
17+ DENO_VERSION : latest
18+ NPM_ARTIFACT_NAME : npm-package
19+ NPM_DIR : ./npm
20+
1621jobs :
17- test :
22+ validate-deno :
1823 runs-on : ubuntu-latest
19-
2024 steps :
21- - name : Setup repo
22- uses : actions/checkout@v6
25+ - uses : actions/checkout@v6
2326
24- - name : Setup Deno
25- uses : denoland/setup-deno@v2
27+ - uses : denoland/setup-deno@v2
2628 with :
27- deno-version : stable
28-
29- - name : Verify formatting
30- run : deno fmt --check
29+ deno-version : ${{ env.DENO_VERSION }}
3130
32- - name : Run linter
33- run : deno lint
31+ - run : deno run -A scripts/pipeline.ts validate-deno
3432
35- - name : Run tests
36- run : deno test -A
33+ - uses : actions/upload-artifact@v4
34+ with :
35+ name : ${{ env.NPM_ARTIFACT_NAME }}
36+ path : ${{ env.NPM_DIR }}
37+ if-no-files-found : error
3738
38- test-node :
39+ test-js-engines :
3940 runs-on : ubuntu-latest
40- needs : test
41+ needs : validate-deno
4142 strategy :
43+ fail-fast : false
4244 matrix :
43- node-version : [22, 24]
45+ include :
46+ - runtime : node
47+ version : 22
48+ - runtime : node
49+ version : 24
50+ - runtime : bun
51+ version : latest
4452
4553 steps :
46- - name : Setup repo
47- uses : actions/checkout@v6
48-
49- - name : Setup Deno
50- uses : denoland/setup-deno@v2
51- with :
52- deno-version : latest
53-
54- - name : Setup Node.js
54+ - if : matrix.runtime == 'node'
5555 uses : actions/setup-node@v6
5656 with :
57- node-version : ${{ matrix.node-version }}
58-
59- - name : Build npm package
60- run : deno run -A scripts/build_npm.ts
61-
62- - name : Install dependencies
63- working-directory : ./npm
64- run : npm install
65-
66- - name : Run Node.js tests
67- working-directory : ./npm
68- run : npm test
69-
70- test-bun :
71- runs-on : ubuntu-latest
72- needs : test
73-
74- steps :
75- - name : Setup repo
76- uses : actions/checkout@v6
77-
78- - name : Setup Deno
79- uses : denoland/setup-deno@v2
80- with :
81- deno-version : stable
57+ node-version : ${{ matrix.version }}
8258
83- - name : Setup Bun
59+ - if : matrix.runtime == 'bun'
8460 uses : oven-sh/setup-bun@v2
8561
86- - name : Build npm package
87- run : deno run -A scripts/build_npm.ts
88-
89- - name : Install dependencies
90- working-directory : ./npm
91- run : bun install
92-
93- - name : Run Bun tests
94- working-directory : ./npm
95- run : bun run test_runner.js
96-
97- tag-and-publish :
98- runs-on : ubuntu-latest
99- needs : [test, test-node, test-bun]
100- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
101- permissions :
102- contents : write
103- outputs :
104- tag : ${{ steps.ver.outputs.tag }}
105- publish : ${{ steps.tagcheck.outputs.publish }}
106- steps :
107- - name : Checkout
108- uses : actions/checkout@v6
109- with :
110- fetch-depth : 0
111-
112- - name : Setup Deno
113- uses : denoland/setup-deno@v2
114- with :
115- deno-version : stable
116-
117- - name : Read version from deno.json
118- id : ver
119- run : |
120- VER=$(deno eval --quiet "console.log(JSON.parse(Deno.readTextFileSync('deno.json')).version)")
121- echo "ver=$VER" >> $GITHUB_OUTPUT
122- echo "tag=v$VER" >> $GITHUB_OUTPUT
123-
124- - name : Ensure release tag points at HEAD
125- id : tagcheck
126- run : |
127- TAG="${{ steps.ver.outputs.tag }}"
128- HEAD_COMMIT=$(git rev-parse HEAD)
129- git fetch --tags --force
130-
131- if git rev-parse --verify "$TAG" >/dev/null 2>&1; then
132- TAG_COMMIT=$(git rev-list -n 1 "$TAG")
133- if [ "$TAG_COMMIT" != "$HEAD_COMMIT" ]; then
134- echo "Tag $TAG already exists at $TAG_COMMIT, but HEAD is $HEAD_COMMIT. Bump deno.json version before publishing."
135- exit 1
136- fi
137- echo "publish=true" >> $GITHUB_OUTPUT
138- exit 0
139- fi
140-
141- git config user.name "github-actions[bot]"
142- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
143- git tag -a "$TAG" -m "Release $TAG (from deno.json)"
144- git push origin "$TAG"
145- echo "publish=true" >> $GITHUB_OUTPUT
146-
147- jsr :
148- runs-on : ubuntu-latest
149- needs : tag-and-publish
150- if : needs.tag-and-publish.outputs.publish == 'true'
151- permissions :
152- contents : read
153- id-token : write
154- steps :
155- - uses : actions/checkout@v6
156- - name : Setup Deno
157- uses : denoland/setup-deno@v2
158- with :
159- deno-version : stable
160- - name : Publish package (JSR)
161- run : deno publish
162-
163- npm :
164- runs-on : ubuntu-latest
165- needs : tag-and-publish
166- if : needs.tag-and-publish.outputs.publish == 'true'
167- permissions :
168- contents : read
169- id-token : write
170- steps :
171- - uses : actions/checkout@v6
172- - name : Setup Deno
173- uses : denoland/setup-deno@v2
174- with :
175- deno-version : stable
176- - name : setup Node
177- uses : actions/setup-node@v6
62+ - uses : actions/download-artifact@v5
17863 with :
179- node-version : 24
180- registry-url : " https://registry.npmjs.org"
181- - name : Build npm package
182- run : deno run -A scripts/build_npm.ts
64+ name : ${{ env.NPM_ARTIFACT_NAME }}
65+ path : ${{ env.NPM_DIR }}
18366
184- - name : Publish package (npm)
185- run : npm publish --provenance --access public
186- working-directory : ./npm
67+ - run : deno run -A scripts/pipeline.ts test-runtime
18768 env :
188- NODE_AUTH_TOKEN : " "
69+ CI_RUNTIME : ${{ matrix.runtime }}
70+ NPM_DIR : ${{ env.NPM_DIR }}
0 commit comments