Skip to content

Commit c28022f

Browse files
committed
fix(github): fix the release pipeline
1 parent 5aa6fd3 commit c28022f

4 files changed

Lines changed: 134 additions & 16 deletions

File tree

.github/workflows/benchmark.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
benchmark:
1313
name: Benchmark
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/matrix.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[
22
{
33
"NAME": "linux-x64-glibc",
4-
"OS": "ubuntu-22.04",
4+
"OS": "ubuntu-latest",
55
"RUN_LOCALLY": true,
66
"TARGET": "x86_64-unknown-linux-gnu"
77
},
88
{
99
"NAME": "linux-x64-musl",
10-
"OS": "ubuntu-22.04",
10+
"OS": "ubuntu-latest",
1111
"RUN_LOCALLY": false,
1212
"TARGET": "x86_64-unknown-linux-musl"
1313
},
1414
{
1515
"NAME": "linux-arm64-glibc",
16-
"OS": "ubuntu-22.04",
16+
"OS": "ubuntu-latest",
1717
"RUN_LOCALLY": false,
1818
"TARGET": "aarch64-unknown-linux-gnu"
1919
},
2020
{
2121
"NAME": "linux-arm64-musl",
22-
"OS": "ubuntu-22.04",
22+
"OS": "ubuntu-latest",
2323
"RUN_LOCALLY": false,
2424
"TARGET": "aarch64-unknown-linux-musl"
2525
},

.github/workflows/release.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,32 @@ 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
64+
- name: Add target to active toolchain
65+
shell: bash
66+
run: rustup target add ${{ matrix.build.TARGET }}
6767
- name: Set up cargo cache
6868
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
6969
- name: Install just
7070
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
7171
with:
7272
just-version: 1.35.0
73-
- name: Build rust binary
74-
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # v1.0.1
73+
- name: Install cross
74+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-latest' }}
75+
uses: taiki-e/install-action@v2
7576
with:
76-
command: build
77-
args: --release --locked --target ${{ matrix.build.TARGET }}
78-
use-cross: ${{ !env.ACT && matrix.build.OS == 'ubuntu-22.04' }}
77+
tool: cross
78+
- name: Build rust binary (cross)
79+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-latest' }}
80+
shell: bash
81+
run: cross build --release --locked --target ${{ matrix.build.TARGET }}
82+
- name: Build rust binary (cargo)
83+
if: ${{ env.ACT || matrix.build.OS != 'ubuntu-latest' }}
84+
shell: bash
85+
run: cargo build --release --locked --target ${{ matrix.build.TARGET }}
7986
- name: Publish rust binary package to npm
8087
shell: bash
8188
run: |
@@ -90,7 +97,7 @@ jobs:
9097
publish-npm-base:
9198
name: Publish npm package
9299
needs: publish-npm-binaries
93-
runs-on: ubuntu-22.04
100+
runs-on: ubuntu-latest
94101
steps:
95102
- name: Checkout
96103
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Test Release Pipeline
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: (Test) 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: Add target to active toolchain
63+
shell: bash
64+
run: rustup target add ${{ matrix.build.TARGET }}
65+
- name: Set up cargo cache
66+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
67+
- name: Install just
68+
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
69+
with:
70+
just-version: 1.35.0
71+
- name: Install cross
72+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-latest' }}
73+
uses: taiki-e/install-action@v2
74+
with:
75+
tool: cross
76+
- name: Build rust binary (cross)
77+
if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-latest' }}
78+
shell: bash
79+
run: cross build --release --locked --target ${{ matrix.build.TARGET }}
80+
- name: Build rust binary (cargo)
81+
if: ${{ env.ACT || matrix.build.OS != 'ubuntu-latest' }}
82+
shell: bash
83+
run: cargo build --release --locked --target ${{ matrix.build.TARGET }}
84+
- name: (Test) Publish rust binary package to npm
85+
shell: bash
86+
run: |
87+
just --dotenv-filename .env.${{ matrix.build.NAME }} create-npm-binary-package
88+
89+
publish-npm-base:
90+
name: (Test) Publish npm package
91+
needs: publish-npm-binaries
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
96+
- name: Install node
97+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
98+
with:
99+
node-version: 24
100+
registry-url: "https://registry.npmjs.org"
101+
- name: Update npm
102+
run: npm install -g npm@latest
103+
- name: Install just
104+
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
105+
with:
106+
just-version: 1.35.0
107+
- name: (Test) Publish the package
108+
shell: bash
109+
run: |
110+
npm install
111+
just --dotenv-filename .env.linux-x64-glibc create-npm-root-package

0 commit comments

Comments
 (0)