Skip to content

Commit be6e382

Browse files
committed
chore: update release workflow
1 parent 113fe8b commit be6e382

1 file changed

Lines changed: 64 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,85 @@
11
name: Release
22

33
on:
4-
# Run `npm run bump` to bump the version and create a git tag.
5-
push:
6-
tags:
7-
- 'v*'
8-
94
workflow_dispatch:
5+
inputs:
6+
npm_tag:
7+
type: choice
8+
description: 'Specify npm tag'
9+
required: true
10+
default: 'alpha'
11+
options:
12+
- alpha
13+
- beta
14+
- rc
15+
- canary
16+
- latest
17+
npm_tag_confirm:
18+
type: choice
19+
description: 'Confirm npm tag'
20+
required: true
21+
options:
22+
- alpha
23+
- beta
24+
- rc
25+
- canary
26+
- latest
27+
branch:
28+
description: 'Release Branch (confirm release branch)'
29+
required: true
30+
default: 'main'
1031

11-
permissions:
12-
contents: read
13-
id-token: write # Required for OIDC
32+
permissions: {}
1433

1534
jobs:
16-
publish:
35+
validate_inputs:
36+
name: Validate Inputs
37+
if: github.repository == 'rstackjs/rstack' && github.event_name == 'workflow_dispatch'
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Validate npm tag confirmation
41+
env:
42+
NPM_TAG: ${{ inputs.npm_tag }}
43+
NPM_TAG_CONFIRM: ${{ inputs.npm_tag_confirm }}
44+
run: |
45+
if [ "$NPM_TAG" != "$NPM_TAG_CONFIRM" ]; then
46+
echo "Error: npm_tag and npm_tag_confirm must match"
47+
echo "npm_tag: $NPM_TAG"
48+
echo "npm_tag_confirm: $NPM_TAG_CONFIRM"
49+
exit 1
50+
fi
51+
echo "npm_tag validation passed: $NPM_TAG"
52+
53+
release:
54+
name: Release
55+
if: github.repository == 'rstackjs/rstack' && github.event_name == 'workflow_dispatch'
56+
needs: validate_inputs
1757
runs-on: ubuntu-latest
1858
environment: npm
59+
permissions:
60+
# Provenance generation in GitHub Actions requires "write" access to the "id-token"
61+
id-token: write
1962
steps:
2063
- name: Checkout
21-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
64+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
65+
with:
66+
fetch-depth: 1
67+
ref: ${{ github.event.inputs.branch }}
2268

2369
- name: Setup Node.js
24-
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
70+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2571
with:
26-
node-version: 24.15.0
72+
node-version: 24.18.0
2773
package-manager-cache: false
2874

29-
- name: Install Pnpm
30-
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
75+
- name: Setup Pnpm
76+
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
3177
with:
3278
run_install: true
3379

34-
- name: Build Packages
80+
- name: Build
3581
run: node --run build
3682

37-
- name: Publish
38-
run: pnpm stage publish --no-git-checks
83+
- name: Publish to npm
84+
run: |
85+
pnpm --filter './packages/*' -r stage publish --tag ${{ github.event.inputs.npm_tag }} --no-git-checks

0 commit comments

Comments
 (0)