forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (112 loc) · 4.06 KB
/
Copy pathrelease-next-rspack.yml
File metadata and controls
132 lines (112 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release next-rspack bindings
on:
workflow_dispatch:
inputs:
dry-run:
description: 'Run in dry-run mode (no actual publishing)'
required: false
default: false
type: boolean
npm-name:
description: 'NPM package name to publish'
required: false
default: '@next/rspack-core'
type: string
npm-tag:
description: 'NPM tag for publishing'
required: false
default: 'latest'
type: choice
options:
- latest
- alpha
- beta
- canary
env:
DEBUG: napi:*
jobs:
build:
name: Build
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@f69dc04fcae6b38d97b87acef448ed7a285b01cc
with:
package-json-path: rspack/crates/binding/package.json
napi-build-command: pnpm build --release
working-directory: rspack
release:
runs-on: ubuntu-latest
environment: npm
name: Release
permissions:
contents: write
id-token: write
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Display release mode
run: |
echo "🚀 Release Configuration:"
echo " - Dry-run mode: ${{ inputs.dry-run }}"
echo " - NPM name: ${{ inputs.npm-name || '@next/rspack-core' }}"
echo " - NPM tag: ${{ inputs.npm-tag || 'latest' }}"
if [ "${{ inputs.dry-run }}" == "true" ]; then
echo " - ⚠️ This is a DRY RUN - no packages will be published"
else
echo " - 📦 This will PUBLISH packages to npm"
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Enable corepack
run: corepack enable
- name: Setup pnpm
run: corepack prepare
- name: Change npm name
run: pnpm run change-npm-name "${{ inputs.npm-name }}"
working-directory: ./rspack
- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-v2-${{ hashFiles('**/pnpm-lock.yaml') }}
# Do not use restore-keys since it leads to indefinite growth of the cache.
- name: Install dependencies
run: pnpm install
working-directory: ./rspack
- name: Get NAPI info
id: napi-info
uses: rspack-contrib/rspack-toolchain/get-napi-info@f69dc04fcae6b38d97b87acef448ed7a285b01cc
with:
package-json-path: rspack/crates/binding/package.json
- name: Download rspack binding
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@f69dc04fcae6b38d97b87acef448ed7a285b01cc
with:
path: ${{ steps.napi-info.outputs.binding-directory }}/artifacts
- name: List artifacts
run: ls -R artifacts
working-directory: ${{ steps.napi-info.outputs.binding-directory }}
- name: Create npm dirs
run: pnpm napi create-npm-dirs
working-directory: ${{ steps.napi-info.outputs.binding-directory }}
- name: Move artifacts
run: pnpm napi artifacts
working-directory: ${{ steps.napi-info.outputs.binding-directory }}
- name: List npm dirs
run: ls -R npm
working-directory: ${{ steps.napi-info.outputs.binding-directory }}
- name: Create npm token
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
- name: Release npm binding packages
run: |
npm config set access public
npm config set provenance true
pnpm napi pre-publish --no-gh-release -t npm ${{ inputs.dry-run && '--dry-run' || '' }}
working-directory: ${{ steps.napi-info.outputs.binding-directory }}
- name: Release npm packages
run: |
pnpm publish -r --tag ${{ inputs.npm-tag }} --no-git-checks --provenance --access public ${{ inputs.dry-run && '--dry-run' || '' }}
working-directory: ./rspack