Skip to content

Commit 126d0fc

Browse files
committed
fix(github): fix release pipeline
1 parent 5aa6fd3 commit 126d0fc

2 files changed

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

0 commit comments

Comments
 (0)