-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (74 loc) · 2.51 KB
/
release.yml
File metadata and controls
88 lines (74 loc) · 2.51 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
name: Release
on:
workflow_dispatch:
inputs:
dry-run:
description: 'Run in dry-run mode (no actual publishing)'
required: false
default: true
type: boolean
npm-tag:
description: 'NPM tag for publishing'
required: false
default: 'latest'
type: choice
options:
- latest
- alpha
- beta
- canary
jobs:
build:
name: Build
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@main
with:
napi-build-command: pnpm build --release
test:
name: Test
uses: ./.github/workflows/test.yml
release:
runs-on: ubuntu-latest
name: Release
permissions:
contents: write
needs: [build, test]
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 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: Get NAPI info
id: napi-info
uses: rspack-contrib/rspack-toolchain/get-napi-info@main
- name: Download rspack binding
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@main
with:
path: ${{ steps.napi-info.outputs.binding-path }}/artifacts
- name: List artifacts
run: ls -R artifacts
working-directory: ${{ steps.napi-info.outputs.binding-path }}
- name: Create npm dirs
run: pnpm napi create-npm-dirs
working-directory: ${{ steps.napi-info.outputs.binding-path }}
- name: Move artifacts
run: pnpm napi artifacts
working-directory: ${{ steps.napi-info.outputs.binding-path }}
- name: List npm dirs
run: ls -R npm
working-directory: ${{ steps.napi-info.outputs.binding-path }}
- name: Link optionalDependencies in binding package.json
run: pnpm napi pre-publish -t npm
working-directory: ${{ steps.napi-info.outputs.binding-path }}
- name: Release npm packages
run: |
pnpm publish -r --tag ${{ inputs.npm-tag }} --no-git-checks --provenance --access public ${{ inputs.dry-run && '--dry-run' || '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}