Skip to content

Commit 54b94f7

Browse files
committed
fix(github): fix release pipeline
1 parent f99d54f commit 54b94f7

2 files changed

Lines changed: 121 additions & 10 deletions

File tree

.github/workflows/release.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,29 @@ jobs:
5757
- name: Update npm
5858
run: npm install -g npm@latest
5959
- name: Install rust toolchain
60-
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6
60+
uses: dtolnay/rust-toolchain@stable
6161
with:
62-
profile: minimal
63-
toolchain: stable
64-
target: ${{ matrix.build.TARGET }}
65-
override: true
62+
targets: ${{ matrix.build.TARGET }}
6663
components: rustfmt, clippy
6764
- name: Set up cargo cache
6865
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
6966
- name: Install just
7067
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
7168
with:
7269
just-version: 1.35.0
73-
- name: Build rust binary
74-
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # v1.0.1
70+
- name: Install cross
71+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
72+
uses: taiki-e/install-action@v2
7573
with:
76-
command: build
77-
args: --release --locked --target ${{ matrix.build.TARGET }}
78-
use-cross: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
74+
tool: cross
75+
- name: Build rust binary (cross)
76+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
77+
shell: bash
78+
run: cross build --release --locked --target ${{ matrix.build.TARGET }}
79+
- name: Build rust binary (cargo)
80+
if: ${{ env.ACT || matrix.build.OS != 'ubuntu-22.04' }}
81+
shell: bash
82+
run: cargo build --release --locked --target ${{ matrix.build.TARGET }}
7983
- name: Publish rust binary package to npm
8084
shell: bash
8185
run: |
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-matrix:
10+
name: Build matrix
11+
runs-on: ubuntu-latest
12+
outputs:
13+
build_matrix: ${{ steps.set-matrix.outputs.build_matrix }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
with:
18+
sparse-checkout: |
19+
.github/workflows/matrix.json
20+
sparse-checkout-cone-mode: false
21+
- id: set-matrix
22+
shell: bash
23+
run: |
24+
if [ "$ACT" == true ]; then
25+
echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output '[.[] | select(.RUN_LOCALLY)]' )" >> $GITHUB_OUTPUT
26+
else
27+
echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output )" >> $GITHUB_OUTPUT
28+
fi
29+
30+
publish-npm-binaries:
31+
name: Publish npm binaries
32+
needs: build-matrix
33+
runs-on: ${{ matrix.build.OS }}
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
build: ${{ fromJson(needs.build-matrix.outputs.build_matrix) }}
38+
steps:
39+
- name: Debug workflow values
40+
shell: bash
41+
run: |
42+
echo "env.ACT : ${{ env.ACT }}"
43+
echo "matrix.build.NAME : ${{ matrix.build.NAME }}"
44+
echo "matrix.build.OS : ${{ matrix.build.OS }}"
45+
echo "matrix.build.RUN_LOCALLY : ${{ matrix.build.RUN_LOCALLY }}"
46+
echo "matrix.build.TARGET : ${{ matrix.build.TARGET }}"
47+
- name: Checkout
48+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49+
- name: Install node
50+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
51+
with:
52+
node-version: 24
53+
registry-url: "https://registry.npmjs.org"
54+
- name: Update npm
55+
run: npm install -g npm@latest
56+
- name: Install rust toolchain
57+
uses: dtolnay/rust-toolchain@stable
58+
with:
59+
targets: ${{ matrix.build.TARGET }}
60+
components: rustfmt, clippy
61+
- name: Set up cargo cache
62+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
63+
- name: Install just
64+
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
65+
with:
66+
just-version: 1.35.0
67+
- name: Install cross
68+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
69+
uses: taiki-e/install-action@v2
70+
with:
71+
tool: cross
72+
- name: Build rust binary (cross)
73+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
74+
shell: bash
75+
run: cross build --release --locked --target ${{ matrix.build.TARGET }}
76+
- name: Build rust binary (cargo)
77+
if: ${{ env.ACT || matrix.build.OS != 'ubuntu-22.04' }}
78+
shell: bash
79+
run: cargo build --release --locked --target ${{ matrix.build.TARGET }}
80+
- name: (Test) Publish rust binary package to npm
81+
shell: bash
82+
run: |
83+
just --dotenv-filename .env.${{ matrix.build.NAME }} create-npm-binary-package
84+
85+
publish-npm-base:
86+
name: (Test) Publish npm package
87+
needs: publish-npm-binaries
88+
runs-on: ubuntu-22.04
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
92+
- name: Install node
93+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
94+
with:
95+
node-version: 24
96+
registry-url: "https://registry.npmjs.org"
97+
- name: Update npm
98+
run: npm install -g npm@latest
99+
- name: Install just
100+
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
101+
with:
102+
just-version: 1.35.0
103+
- name: (Test) Publish the package
104+
shell: bash
105+
run: |
106+
npm install
107+
just --dotenv-filename .env.linux-x64-glibc create-npm-root-package

0 commit comments

Comments
 (0)