@@ -16,20 +16,20 @@ jobs:
1616 runs-on : ubuntu-latest
1717 steps :
1818 - name : Cancel Previous Runs
19- uses : styfle/cancel-workflow-action@0.11.0
19+ uses : styfle/cancel-workflow-action@0.12.1
2020 with :
2121 access_token : ${{ github.token }}
2222
2323 build_linux-x64-musl :
2424 runs-on : ubuntu-latest
2525 steps :
26- - uses : actions/checkout@v3
26+ - uses : actions/checkout@v5
2727 - uses : dtolnay/rust-toolchain@stable
2828 with :
2929 targets : x86_64-unknown-linux-musl
30- - uses : actions/setup-node@v3
30+ - uses : actions/setup-node@v6
3131 with :
32- node-version : ' 16 '
32+ node-version : ' 20 '
3333 - uses : Swatinem/rust-cache@v2
3434 - name : Download x86_64-linux-musl-cross toolchain
3535 run : curl -O -L -C - https://github.com/musl-cc/musl.cc/releases/download/v0.0.1/x86_64-linux-musl-cross.tgz
4949 run : npm i
5050 - name : Build
5151 run : npm run build:cargo
52- - uses : actions/upload-artifact@v4
52+ - uses : actions/upload-artifact@v5
5353 with :
5454 name : linux-x64-musl
5555 path : native/linux-x64-musl.node
@@ -58,13 +58,13 @@ jobs:
5858 build_linux-arm64-musl :
5959 runs-on : ubuntu-latest
6060 steps :
61- - uses : actions/checkout@v3
61+ - uses : actions/checkout@v5
6262 - uses : dtolnay/rust-toolchain@stable
6363 with :
6464 targets : aarch64-unknown-linux-musl
65- - uses : actions/setup-node@v3
65+ - uses : actions/setup-node@v6
6666 with :
67- node-version : ' 16 '
67+ node-version : ' 20 '
6868 - uses : Swatinem/rust-cache@v2
6969 - name : Download aarch64-linux-musl-cross toolchain
7070 run : curl -O -L -C - https://github.com/musl-cc/musl.cc/releases/download/v0.0.1/aarch64-linux-musl-cross.tgz
8484 run : npm i
8585 - name : Build
8686 run : npm run build:cargo
87- - uses : actions/upload-artifact@v4
87+ - uses : actions/upload-artifact@v5
8888 with :
8989 name : linux-arm64-musl
9090 path : native/linux-arm64-musl.node
@@ -95,19 +95,19 @@ jobs:
9595 container :
9696 image : rust
9797 steps :
98- - uses : actions/checkout@v3
98+ - uses : actions/checkout@v5
9999 - uses : dtolnay/rust-toolchain@stable
100100 with :
101101 targets : x86_64-unknown-linux-gnu
102- - uses : actions/setup-node@v3
102+ - uses : actions/setup-node@v6
103103 with :
104- node-version : ' 16 '
104+ node-version : ' 20 '
105105 - uses : Swatinem/rust-cache@v2
106106 - name : npm i
107107 run : npm i
108108 - name : Build
109109 run : npm run build:cargo
110- - uses : actions/upload-artifact@v4
110+ - uses : actions/upload-artifact@v5
111111 with :
112112 name : linux-x64-glibc
113113 path : native/linux-x64-glibc.node
@@ -118,13 +118,13 @@ jobs:
118118 container :
119119 image : rust
120120 steps :
121- - uses : actions/checkout@v3
121+ - uses : actions/checkout@v5
122122 - uses : dtolnay/rust-toolchain@stable
123123 with :
124124 targets : aarch64-unknown-linux-gnu
125- - uses : actions/setup-node@v3
125+ - uses : actions/setup-node@v6
126126 with :
127- node-version : ' 16 '
127+ node-version : ' 20 '
128128 - uses : Swatinem/rust-cache@v2
129129 - name : Install cross compile deps
130130 run : |
@@ -141,7 +141,7 @@ jobs:
141141 run : npm i
142142 - name : Build
143143 run : npm run build:cargo
144- - uses : actions/upload-artifact@v4
144+ - uses : actions/upload-artifact@v5
145145 with :
146146 name : linux-arm64-glibc
147147 path : native/linux-arm64-glibc.node
@@ -150,19 +150,19 @@ jobs:
150150 build_win-x64 :
151151 runs-on : windows-2022
152152 steps :
153- - uses : actions/checkout@v3
153+ - uses : actions/checkout@v5
154154 - uses : dtolnay/rust-toolchain@stable
155155 with :
156156 targets : x86_64-pc-windows-msvc
157- - uses : actions/setup-node@v3
157+ - uses : actions/setup-node@v6
158158 with :
159- node-version : ' 16 '
159+ node-version : ' 20 '
160160 - uses : Swatinem/rust-cache@v2
161161 - name : npm i
162162 run : npm i
163163 - name : Build
164164 run : npm run build:cargo
165- - uses : actions/upload-artifact@v4
165+ - uses : actions/upload-artifact@v5
166166 with :
167167 name : win32-x64
168168 path : native/win32-x64.node
@@ -172,19 +172,19 @@ jobs:
172172 if : ${{ false }}
173173 runs-on : macos-14
174174 steps :
175- - uses : actions/checkout@v3
175+ - uses : actions/checkout@v5
176176 - uses : dtolnay/rust-toolchain@stable
177177 with :
178178 targets : x86_64-apple-darwin
179- - uses : actions/setup-node@v3
179+ - uses : actions/setup-node@v6
180180 with :
181- node-version : ' 16 '
181+ node-version : ' 20 '
182182 - uses : Swatinem/rust-cache@v2
183183 - name : npm i
184184 run : npm i
185185 - name : Build
186186 run : npm run build:cargo
187- - uses : actions/upload-artifact@v4
187+ - uses : actions/upload-artifact@v5
188188 with :
189189 name : darwin-x64
190190 path : native/darwin-x64.node
@@ -193,13 +193,13 @@ jobs:
193193 build_darwin-arm64 :
194194 runs-on : macos-14
195195 steps :
196- - uses : actions/checkout@v3
196+ - uses : actions/checkout@v5
197197 - uses : dtolnay/rust-toolchain@stable
198198 with :
199199 targets : aarch64-apple-darwin
200- - uses : actions/setup-node@v3
200+ - uses : actions/setup-node@v6
201201 with :
202- node-version : ' 16 '
202+ node-version : ' 20 '
203203 - uses : Swatinem/rust-cache@v2
204204 - name : Configure macos-arm64 cross compile
205205 run : |
@@ -210,7 +210,7 @@ jobs:
210210 run : npm i
211211 - name : Build
212212 run : npm run build:cargo
213- - uses : actions/upload-artifact@v4
213+ - uses : actions/upload-artifact@v5
214214 with :
215215 name : darwin-arm64
216216 path : native/darwin-arm64.node
@@ -221,8 +221,8 @@ jobs:
221221 needs :
222222 - build_linux-arm64-glibc
223223 steps :
224- - uses : actions/checkout@v3
225- - uses : actions/download-artifact@v4
224+ - uses : actions/checkout@v5
225+ - uses : actions/download-artifact@v6
226226 with :
227227 name : linux-arm64-glibc
228228 path : native
@@ -238,7 +238,7 @@ jobs:
238238 githubToken : ${{ github.token }}
239239 install : |
240240 apt-get update && apt-get install -y curl
241- curl -fsSL https://deb.nodesource.com/setup_16 .x | bash -
241+ curl -fsSL https://deb.nodesource.com/setup_20 .x | bash -
242242 apt-get install -y --no-install-recommends nodejs
243243 run : |
244244 npm run test:js
@@ -248,8 +248,8 @@ jobs:
248248 needs :
249249 - build_linux-arm64-musl
250250 steps :
251- - uses : actions/checkout@v3
252- - uses : actions/download-artifact@v4
251+ - uses : actions/checkout@v5
252+ - uses : actions/download-artifact@v6
253253 with :
254254 name : linux-arm64-musl
255255 path : native
@@ -275,8 +275,8 @@ jobs:
275275 needs :
276276 - build_linux-x64-glibc
277277 steps :
278- - uses : actions/checkout@v3
279- - uses : actions/download-artifact@v4
278+ - uses : actions/checkout@v5
279+ - uses : actions/download-artifact@v6
280280 with :
281281 name : linux-x64-glibc
282282 path : native
@@ -297,8 +297,8 @@ jobs:
297297 needs :
298298 - build_linux-x64-musl
299299 steps :
300- - uses : actions/checkout@v3
301- - uses : actions/download-artifact@v4
300+ - uses : actions/checkout@v5
301+ - uses : actions/download-artifact@v6
302302 with :
303303 name : linux-x64-musl
304304 path : native
@@ -317,8 +317,8 @@ jobs:
317317 needs :
318318 - build_win-x64
319319 steps :
320- - uses : actions/checkout@v3
321- - uses : actions/download-artifact@v4
320+ - uses : actions/checkout@v5
321+ - uses : actions/download-artifact@v6
322322 with :
323323 name : win32-x64
324324 path : native
@@ -338,8 +338,8 @@ jobs:
338338 needs :
339339 - build_darwin-x64
340340 steps :
341- - uses : actions/checkout@v3
342- - uses : actions/download-artifact@v4
341+ - uses : actions/checkout@v5
342+ - uses : actions/download-artifact@v6
343343 with :
344344 name : darwin-x64
345345 path : native
@@ -353,26 +353,45 @@ jobs:
353353 working-directory : examples
354354 run : npm i && npm test
355355
356- npm-package :
357- runs-on : ubuntu-latest
356+ build-publish :
358357 needs :
359358 - build_linux-x64-musl
360359 - build_linux-arm64-musl
361360 - build_linux-x64-glibc
362361 - build_linux-arm64-glibc
363362 - build_win-x64
364363 - build_darwin-arm64
365- env :
366- NPM_PACKAGE_VERSION : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.npm-package-version || '0.0.1-alpha.0' }}
367- NPM_PACKAGE_TAG : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.npm-package-tag || 'alpha' }}
364+ permissions :
365+ contents : write
366+ id-token : write
367+ issues : write
368+ pull-requests : write
369+ runs-on : ubuntu-latest
370+ outputs :
371+ docker_image_digest : ${{ steps.docker_push.outputs.digest }}
372+ version : ${{ steps.docker_meta.outputs.version }}
373+ new_release_published : ${{ steps.semantic.outputs.new_release_published }}
368374 steps :
369- - uses : actions/checkout@v3
370- - uses : actions/setup-node@v3
375+ - name : Generate release bot app token
376+ id : generate_token
377+ uses : actions/create-github-app-token@v2
371378 with :
372- node-version : ' 16'
373- registry-url : https://registry.npmjs.org
374- always-auth : true
375- - uses : actions/download-artifact@v4
379+ app-id : ${{ secrets.HIROSYSTEMS_RELEASE_BOT_ID }}
380+ private-key : ${{ secrets.HIROSYSTEMS_RELEASE_BOT_PEM }}
381+
382+ - name : Checkout
383+ uses : actions/checkout@v5
384+ with :
385+ persist-credentials : false
386+
387+ - name : Get bot user ID
388+ id : bot-user-id
389+ run : |
390+ echo "user-id=$(gh api "/users/${{ steps.generate_token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
391+ env :
392+ GH_TOKEN : ${{ steps.generate_token.outputs.token }}
393+
394+ - uses : actions/download-artifact@v6
376395 with :
377396 path : native
378397 - name : Position downloaded artifacts
@@ -381,23 +400,19 @@ jobs:
381400 find ./native -mindepth 2 -type f -exec mv -t ./native -i '{}' +
382401 find ./native -mindepth 1 -type d -empty -delete
383402 ls -R ./native
384- - name : npm version
385- run : npm version --git-tag-version=false --allow-same-version $NPM_PACKAGE_VERSION
386- - name : npm build
387- run : |
388- npm i
389- npm run build:ts
390- - name : npm pack
391- run : |
392- npm pack
393- mv "stacks-encoding-native-js-$NPM_PACKAGE_VERSION.tgz" "stacks-encoding-native-js.tgz"
394- - uses : actions/upload-artifact@v4
395- with :
396- name : stacks-encoding-native-js.tgz
397- path : stacks-encoding-native-js.tgz
398- if-no-files-found : error
399- - name : Publish npm package
400- if : github.event_name == 'workflow_dispatch'
403+
404+ - name : Semantic Release
405+ uses : cycjimmy/semantic-release-action@9cc899c47e6841430bbaedb43de1560a568dfd16 # v5
406+ id : semantic
407+ if : github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
401408 env :
402- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
403- run : npm publish stacks-encoding-native-js.tgz --tag $NPM_PACKAGE_TAG --access public
409+ GITHUB_TOKEN : ${{ steps.generate_token.outputs.token }}
410+ SEMANTIC_RELEASE_PACKAGE : ${{ github.event.repository.name }}
411+ GIT_AUTHOR_EMAIL : " ${{ steps.bot-user-id.outputs.user-id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com"
412+ GIT_COMMITTER_EMAIL : " ${{ steps.bot-user-id.outputs.user-id }}+${{ steps.generate_token.outputs.app-slug }}[bot]@users.noreply.github.com"
413+ with :
414+ extra_plugins : |
415+ @semantic-release/[email protected] 416+ @semantic-release/[email protected] 417+ @semantic-release/[email protected] 418+
0 commit comments