Skip to content

Commit e2d8512

Browse files
authored
chore: try release canary (#13)
* chore: try release canary * ci: test requires build * fix: add pnpm * fix: fix release script * fix: fix again * fix: fix again * fix: fix again * fix: fix enviromnent * fix: access public
1 parent a61b5af commit e2d8512

4 files changed

Lines changed: 53 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,28 @@ on:
1919
- beta
2020
- canary
2121

22+
env:
23+
DEBUG: napi:*
24+
2225
jobs:
2326
build:
2427
name: Build
2528
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@main
2629
with:
27-
napi-build-command: pnpm build --release
30+
napi-build-command: pnpm build
2831

2932
test:
3033
name: Test
3134
uses: ./.github/workflows/test.yml
35+
needs: build
3236

3337
release:
3438
runs-on: ubuntu-latest
39+
environment: npm
3540
name: Release
3641
permissions:
3742
contents: write
43+
id-token: write
3844
needs: [build, test]
3945

4046
steps:
@@ -52,6 +58,28 @@ jobs:
5258
echo " - 📦 This will PUBLISH packages to npm"
5359
fi
5460
61+
- name: Setup Node.js
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: '22'
65+
66+
- name: Enable corepack
67+
run: corepack enable
68+
69+
- name: Setup pnpm
70+
run: corepack prepare
71+
72+
- name: Cache pnpm dependencies
73+
uses: actions/cache@v3
74+
with:
75+
path: ~/.pnpm-store
76+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
77+
restore-keys: |
78+
${{ runner.os }}-pnpm-
79+
80+
- name: Install dependencies
81+
run: pnpm install
82+
5583
- name: Get NAPI info
5684
id: napi-info
5785
uses: rspack-contrib/rspack-toolchain/get-napi-info@main
@@ -77,12 +105,23 @@ jobs:
77105
run: ls -R npm
78106
working-directory: ${{ steps.napi-info.outputs.binding-path }}
79107

80-
- name: Link optionalDependencies in binding package.json
81-
run: pnpm napi pre-publish -t npm
108+
- name: Create npm token
109+
run: |
110+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
111+
env:
112+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
113+
114+
- name: Release npm binding packages
115+
run: |
116+
npm config set access public
117+
npm config set provenance true
118+
pnpm napi pre-publish --no-gh-release -t npm
82119
working-directory: ${{ steps.napi-info.outputs.binding-path }}
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83122

84123
- name: Release npm packages
85124
run: |
86125
pnpm publish -r --tag ${{ inputs.npm-tag }} --no-git-checks --provenance --access public ${{ inputs.dry-run && '--dry-run' || '' }}
87126
env:
88-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

crates/binding/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rspack-template/binding",
3-
"version": "0.0.0",
3+
"version": "0.0.0-canary.0",
44
"homepage": "https://github.com/rspack-contrib/rspack-binding-template",
55
"bugs": {
66
"url": "https://github.com/rspack-contrib/rspack-binding-template/issues"
@@ -10,6 +10,14 @@
1010
"url": "git+https://github.com/rspack-contrib/rspack-binding-template.git",
1111
"directory": "crates/binding"
1212
},
13+
"main": "index.js",
14+
"exports": {
15+
".": {
16+
"types": "./index.d.ts",
17+
"default": "./index.js"
18+
},
19+
"./package.json": "./package.json"
20+
},
1321
"files": [
1422
"index.js",
1523
"index.d.ts"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rspack-template/core",
3-
"version": "0.0.0",
3+
"version": "0.0.0-canary.0",
44
"homepage": "https://github.com/rspack-contrib/rspack-binding-template",
55
"bugs": {
66
"url": "https://github.com/rspack-contrib/rspack-binding-template/issues"

pnpm-workspace.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
packages:
22
- 'crates/binding'
3-
- 'crates/binding/npm/**'
43
- 'examples/plugin'
54
- '.'

0 commit comments

Comments
 (0)