Skip to content

Commit a61b5af

Browse files
authored
chore: try to release bindings and core (#12)
* chore: try to release bindings and core * chore: temporarily disable non-darwin tests
1 parent 2cd050b commit a61b5af

6 files changed

Lines changed: 177 additions & 75 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -52,66 +52,6 @@ jobs:
5252
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@main
5353

5454
test:
55-
runs-on: ${{ matrix.os }}
56-
name: Node Test (${{ matrix.os }})
55+
name: Test
56+
uses: ./.github/workflows/test.yml
5757
needs: build
58-
59-
strategy:
60-
fail-fast: false
61-
matrix:
62-
include:
63-
- os: ubuntu-latest
64-
target: x86_64-unknown-linux-gnu
65-
- os: macos-latest
66-
target: aarch64-apple-darwin
67-
- os: windows-latest
68-
target: x86_64-pc-windows-msvc
69-
70-
steps:
71-
- name: Checkout code
72-
uses: actions/checkout@v4
73-
74-
- name: Get NAPI info
75-
id: napi-info
76-
uses: rspack-contrib/rspack-toolchain/get-napi-info@main
77-
78-
- name: Download rspack binding
79-
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
80-
with:
81-
target: ${{ matrix.target }}
82-
path: ${{ steps.napi-info.outputs.binding-path }}
83-
84-
- name: Show binding
85-
shell: bash
86-
run: |
87-
echo "Contents of binding directory:"
88-
ls -la ${{ steps.napi-info.outputs.binding-path }}
89-
echo ""
90-
echo "*.node files:"
91-
find ${{ steps.napi-info.outputs.binding-path }} -name "*.node" -type f -exec ls -la {} \; || echo "No .node files found"
92-
93-
- name: Setup Node.js
94-
uses: actions/setup-node@v4
95-
with:
96-
node-version: '22'
97-
98-
- name: Enable corepack
99-
run: corepack enable
100-
101-
- name: Setup pnpm
102-
run: corepack prepare
103-
104-
- name: Cache pnpm dependencies
105-
uses: actions/cache@v3
106-
with:
107-
path: ~/.pnpm-store
108-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
109-
restore-keys: |
110-
${{ runner.os }}-pnpm-
111-
112-
- name: Install dependencies
113-
run: pnpm install
114-
115-
- name: Run example - plugin
116-
run: node build.js
117-
working-directory: examples/plugin

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry-run:
7+
description: 'Run in dry-run mode (no actual publishing)'
8+
required: false
9+
default: true
10+
type: boolean
11+
npm-tag:
12+
description: 'NPM tag for publishing'
13+
required: false
14+
default: 'latest'
15+
type: choice
16+
options:
17+
- latest
18+
- alpha
19+
- beta
20+
- canary
21+
22+
jobs:
23+
build:
24+
name: Build
25+
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@main
26+
with:
27+
napi-build-command: pnpm build --release
28+
29+
test:
30+
name: Test
31+
uses: ./.github/workflows/test.yml
32+
33+
release:
34+
runs-on: ubuntu-latest
35+
name: Release
36+
permissions:
37+
contents: write
38+
needs: [build, test]
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Display release mode
45+
run: |
46+
echo "🚀 Release Configuration:"
47+
echo " - Dry-run mode: ${{ inputs.dry-run }}"
48+
echo " - NPM tag: ${{ inputs.npm-tag || 'latest' }}"
49+
if [ "${{ inputs.dry-run }}" == "true" ]; then
50+
echo " - ⚠️ This is a DRY RUN - no packages will be published"
51+
else
52+
echo " - 📦 This will PUBLISH packages to npm"
53+
fi
54+
55+
- name: Get NAPI info
56+
id: napi-info
57+
uses: rspack-contrib/rspack-toolchain/get-napi-info@main
58+
59+
- name: Download rspack binding
60+
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
61+
with:
62+
path: ${{ steps.napi-info.outputs.binding-path }}/artifacts
63+
64+
- name: List artifacts
65+
run: ls -R artifacts
66+
working-directory: ${{ steps.napi-info.outputs.binding-path }}
67+
68+
- name: Create npm dirs
69+
run: pnpm napi create-npm-dirs
70+
working-directory: ${{ steps.napi-info.outputs.binding-path }}
71+
72+
- name: Move artifacts
73+
run: pnpm napi artifacts
74+
working-directory: ${{ steps.napi-info.outputs.binding-path }}
75+
76+
- name: List npm dirs
77+
run: ls -R npm
78+
working-directory: ${{ steps.napi-info.outputs.binding-path }}
79+
80+
- name: Link optionalDependencies in binding package.json
81+
run: pnpm napi pre-publish -t npm
82+
working-directory: ${{ steps.napi-info.outputs.binding-path }}
83+
84+
- name: Release npm packages
85+
run: |
86+
pnpm publish -r --tag ${{ inputs.npm-tag }} --no-git-checks --provenance --access public ${{ inputs.dry-run && '--dry-run' || '' }}
87+
env:
88+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
runs-on: ${{ matrix.os }}
9+
name: Node Test (${{ matrix.os }})
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
# - os: ubuntu-latest
16+
# target: x86_64-unknown-linux-gnu
17+
- os: macos-latest
18+
target: aarch64-apple-darwin
19+
# - os: windows-latest
20+
# target: x86_64-pc-windows-msvc
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Get NAPI info
27+
id: napi-info
28+
uses: rspack-contrib/rspack-toolchain/get-napi-info@main
29+
30+
- name: Download rspack binding
31+
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
32+
with:
33+
target: ${{ matrix.target }}
34+
path: ${{ steps.napi-info.outputs.binding-path }}
35+
36+
- name: Show binding
37+
shell: bash
38+
run: |
39+
echo "Contents of binding directory:"
40+
ls -la ${{ steps.napi-info.outputs.binding-path }}
41+
echo ""
42+
echo "*.node files:"
43+
find ${{ steps.napi-info.outputs.binding-path }} -name "*.node" -type f -exec ls -la {} \; || echo "No .node files found"
44+
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: '22'
49+
50+
- name: Enable corepack
51+
run: corepack enable
52+
53+
- name: Setup pnpm
54+
run: corepack prepare
55+
56+
- name: Cache pnpm dependencies
57+
uses: actions/cache@v3
58+
with:
59+
path: ~/.pnpm-store
60+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
61+
restore-keys: |
62+
${{ runner.os }}-pnpm-
63+
64+
- name: Install dependencies
65+
run: pnpm install
66+
67+
- name: Run example - plugin
68+
run: node build.js
69+
working-directory: examples/plugin

crates/binding/package.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"name": "@rspack-template/binding",
3+
"version": "0.0.0",
4+
"homepage": "https://github.com/rspack-contrib/rspack-binding-template",
5+
"bugs": {
6+
"url": "https://github.com/rspack-contrib/rspack-binding-template/issues"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/rspack-contrib/rspack-binding-template.git",
11+
"directory": "crates/binding"
12+
},
13+
"files": [
14+
"index.js",
15+
"index.d.ts"
16+
],
317
"scripts": {
418
"build": "napi build --platform"
519
},
@@ -12,17 +26,7 @@
1226
"binaryName": "binding",
1327
"targets": [
1428
"x86_64-apple-darwin",
15-
"x86_64-pc-windows-msvc",
16-
"x86_64-unknown-linux-gnu",
17-
"x86_64-unknown-linux-musl",
18-
"i686-pc-windows-msvc",
19-
"aarch64-unknown-linux-gnu",
20-
"aarch64-apple-darwin",
21-
"aarch64-unknown-linux-musl",
22-
"aarch64-pc-windows-msvc",
23-
"armv7-linux-androideabi",
24-
"armv7-unknown-linux-gnueabihf",
25-
"aarch64-linux-android"
29+
"aarch64-apple-darwin"
2630
]
2731
}
2832
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@rspack-template/core",
3+
"version": "0.0.0",
34
"homepage": "https://github.com/rspack-contrib/rspack-binding-template",
45
"bugs": {
56
"url": "https://github.com/rspack-contrib/rspack-binding-template/issues"
@@ -15,8 +16,7 @@
1516
"./package.json": "./package.json"
1617
},
1718
"files": [
18-
"lib",
19-
"package.json"
19+
"lib"
2020
],
2121
"scripts": {
2222
"prepare": "husky",

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
packages:
22
- 'crates/binding'
3+
- 'crates/binding/npm/**'
34
- 'examples/plugin'
45
- '.'

0 commit comments

Comments
 (0)