Skip to content

Commit e946b6a

Browse files
Consolidate tag-release workflow
1 parent fba6a23 commit e946b6a

File tree

4 files changed

+19
-213
lines changed

4 files changed

+19
-213
lines changed

.github/workflows/canary-release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ jobs:
1818
release-command: |
1919
yarn canary:release --summary-file
2020
node scripts/tag-release.mjs --tag nightly
21+
type: canary

.github/workflows/dev-release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ jobs:
1313
secrets: inherit
1414
with:
1515
release-command: yarn dev:release
16+
type: dev

.github/workflows/release.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
description: 'The command that will release packages as part of the final step'
88
required: true
99
type: string
10+
type:
11+
description: 'The type of release, usually corresponds to the dist-tag'
12+
required: true
13+
type: string
1014
secrets:
1115
GHCR_TOKEN:
1216
required: true
@@ -42,6 +46,7 @@ jobs:
4246
target: ${{ matrix.target }}
4347
- uses: bahmutov/[email protected]
4448
- uses: Swatinem/rust-cache@v2
49+
if: ${{ inputs.type != 'latest' }}
4550
with:
4651
shared-key: ${{ matrix.name }}
4752
- name: Remove CommandLineTools SDKs
@@ -124,6 +129,7 @@ jobs:
124129
sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
125130
- uses: bahmutov/[email protected]
126131
- uses: Swatinem/rust-cache@v2
132+
if: ${{ inputs.type != 'latest' }}
127133
with:
128134
shared-key: ${{ matrix.target }}
129135
- name: Build native packages
@@ -201,9 +207,10 @@ jobs:
201207
runs-on: ubuntu-20.04
202208
name: Build and release
203209
needs:
204-
- build-macos-windows
205-
- build-linux-musl
206210
- build-linux-gnu-arm
211+
- build-linux-gnu-x64
212+
- build-linux-musl
213+
- build-macos-windows
207214
steps:
208215
- uses: actions/checkout@v4
209216
with:

.github/workflows/tag-release.yml

+8-211
Original file line numberDiff line numberDiff line change
@@ -1,228 +1,25 @@
11
name: tag-release
2+
23
on:
34
release:
45
types: [published]
56
workflow_dispatch:
6-
permissions:
7-
contents: read # for actions/checkout
8-
jobs:
9-
build:
10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
os: [macos-latest, windows-latest]
14-
name: ${{ matrix.os }}
15-
runs-on: ${{ matrix.os }}
16-
steps:
17-
- uses: actions/checkout@v4
18-
- name: Install Rust
19-
uses: dtolnay/rust-toolchain@master
20-
with:
21-
toolchain: stable
22-
- uses: bahmutov/[email protected]
23-
- name: Build native packages
24-
run: yarn build-native-release
25-
- name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
26-
if: ${{ matrix.os == 'macos-latest' }}
27-
run: strip -x packages/*/*/*.node # Must use -x on macOS. This produces larger results on linux.
28-
- name: Upload artifacts
29-
uses: actions/upload-artifact@v3
30-
with:
31-
name: bindings-${{ matrix.os }}
32-
path: packages/*/*/*.node
33-
- name: Smoke test
34-
run: node -e "require('@parcel/rust')"
35-
36-
build-linux-gnu-x64:
37-
name: linux-gnu-x64
38-
runs-on: ubuntu-20.04
39-
container:
40-
image: docker.io/mischnic/centos7-node16
41-
steps:
42-
- uses: actions/checkout@v3
43-
- name: Install yarn
44-
run: npm install --global yarn@1
45-
- name: Install Rust
46-
uses: actions-rs/toolchain@v1
47-
with:
48-
toolchain: stable
49-
profile: minimal
50-
override: true
51-
- uses: bahmutov/[email protected]
52-
- name: Build native packages
53-
run: yarn build-native-release
54-
- name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
55-
run: strip packages/*/*/*.node
56-
- name: Upload artifacts
57-
uses: actions/upload-artifact@v3
58-
with:
59-
name: bindings-linux-gnu-x64
60-
path: packages/*/*/*.node
61-
- name: debug
62-
run: ls -l packages/*/*/*.node
63-
- name: Smoke test
64-
run: node -e 'require("@parcel/rust")'
65-
66-
build-linux-gnu-arm:
67-
strategy:
68-
fail-fast: false
69-
matrix:
70-
include:
71-
- target: arm-unknown-linux-gnueabihf
72-
arch: armhf
73-
strip: arm-linux-gnueabihf-strip
74-
cflags: -mfpu=neon
75-
- target: aarch64-unknown-linux-gnu
76-
arch: arm64
77-
strip: aarch64-linux-gnu-strip
78-
cflags: ''
79-
name: ${{ matrix.target }}
80-
runs-on: ubuntu-20.04
81-
steps:
82-
- uses: actions/checkout@v4
83-
- name: Install Rust
84-
uses: dtolnay/rust-toolchain@master
85-
with:
86-
toolchain: stable
87-
target: ${{ matrix.target }}
88-
- name: Install cross compile toolchains
89-
run: |
90-
sudo apt-get update
91-
sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y
92-
- uses: bahmutov/[email protected]
93-
- name: Build native packages
94-
run: yarn build-native-release
95-
env:
96-
RUST_TARGET: ${{ matrix.target }}
97-
CFLAGS: ${{ matrix.cflags }}
98-
- name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
99-
run: ${{ matrix.strip }} packages/*/*/*.node
100-
- name: Upload artifacts
101-
uses: actions/upload-artifact@v3
102-
with:
103-
name: bindings-${{ matrix.target }}
104-
path: packages/*/*/*.node
105-
- name: debug
106-
run: ls -l packages/*/*/*.node
107-
- name: Configure binfmt-support
108-
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
109-
- name: Smoke test
110-
uses: addnab/docker-run-action@v1
111-
with:
112-
image: ghcr.io/devongovett/multiarch-node:node14-${{ matrix.arch }}-focal
113-
options: -v ${{github.workspace}}:/work
114-
run: cd /work && node -e "require('@parcel/rust')"
115-
116-
build-linux-musl:
117-
strategy:
118-
fail-fast: false
119-
matrix:
120-
include:
121-
- target: x86_64-unknown-linux-musl
122-
strip: strip
123-
cflags: -msse4.2
124-
arch: x86_64
125-
- target: aarch64-unknown-linux-musl
126-
strip: aarch64-linux-musl-strip
127-
cflags: ''
128-
arch: aarch64
129-
name: ${{ matrix.target }}
130-
runs-on: ubuntu-20.04
131-
container:
132-
image: ghcr.io/napi-rs/napi-rs/nodejs-rust@sha256:5a99e45446355d25c20e95d35231d84e9ce472280d8c0b1be53281bade905f09
133-
credentials:
134-
username: ${{ github.actor }}
135-
password: ${{ secrets.GHCR_TOKEN }}
136-
steps:
137-
- uses: actions/checkout@v4
138-
- name: Install build tools
139-
run: apk add --no-cache python3 make gcc g++ musl-dev curl
140-
- name: Install Rust
141-
uses: dtolnay/rust-toolchain@master
142-
with:
143-
toolchain: stable
144-
target: ${{ matrix.target }}
145-
- uses: bahmutov/[email protected]
146-
- name: Build native packages
147-
run: yarn build-native-release
148-
env:
149-
RUST_TARGET: ${{ matrix.target }}
150-
CFLAGS: ${{ matrix.cflags }}
151-
- name: Strip debug symbols # https://github.com/rust-lang/rust/issues/46034
152-
run: ${{ matrix.strip }} packages/*/*/*.node
153-
- name: Upload artifacts
154-
uses: actions/upload-artifact@v3
155-
with:
156-
name: bindings-linux-musl-${{ matrix.arch }}
157-
path: packages/*/*/*.node
158-
- name: debug
159-
run: ls -l packages/*/*/*.node
160-
- name: Smoke test
161-
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
162-
run: node -e 'require("@parcel/rust")'
163-
164-
build-apple-silicon:
165-
name: aarch64-apple-darwin
166-
runs-on: macos-latest
167-
steps:
168-
- uses: actions/checkout@v4
169-
- name: Install Rust
170-
uses: dtolnay/rust-toolchain@master
171-
with:
172-
toolchain: stable
173-
target: aarch64-apple-darwin
174-
- uses: bahmutov/[email protected]
175-
- name: Build native packages
176-
run: |
177-
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
178-
yarn build-native-release
179-
env:
180-
RUST_TARGET: aarch64-apple-darwin
181-
JEMALLOC_SYS_WITH_LG_PAGE: 14
182-
- name: Strip debug symbols
183-
run: strip -x packages/*/*/*.node
184-
- name: Upload artifacts
185-
uses: actions/upload-artifact@v3
186-
with:
187-
name: bindings-apple-aarch64
188-
path: packages/*/*/*.node
189-
- name: debug
190-
run: ls -l packages/*/*/*.node
1917

8+
jobs:
1929
build-and-release:
193-
runs-on: ubuntu-20.04
19410
name: Build and release the tagged version
195-
needs:
196-
- build
197-
- build-linux-musl
198-
- build-linux-gnu-x64
199-
- build-linux-gnu-arm
200-
- build-apple-silicon
201-
steps:
202-
- uses: actions/checkout@v4
203-
with:
204-
fetch-depth: 0
205-
- uses: bahmutov/[email protected]
206-
- name: Build native packages
207-
run: yarn build-native-release
208-
- name: Download artifacts
209-
uses: actions/download-artifact@v3
210-
with:
211-
path: artifacts
212-
- name: Move artifacts
213-
run: for d in artifacts/*/*/*; do cp $d/*.node packages/$(basename $(dirname $d))/$(basename $d); done
214-
- name: Debug
215-
run: ls -l packages/*/*/*.node
216-
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
217-
env:
218-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
219-
- run: yarn release
11+
uses: ./.github/workflows/release.yml
12+
secrets: inherit
13+
with:
14+
release-command: yarn release
15+
type: latest
22016

22117
# Deployment steps taken from https://github.com/colinwilson/static-site-to-vercel/blob/master/.github/workflows/deploy-preview.yml
22218
repl_build:
22319
name: Build REPL
22420
runs-on: ubuntu-latest
22521
permissions:
22+
contents: read
22623
deployments: write
22724
steps:
22825
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)