|
1 | 1 | name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - # Run `npm run bump` to bump the version and create a git tag. |
5 | | - push: |
6 | | - tags: |
7 | | - - 'v*' |
8 | | - |
9 | 4 | 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' |
10 | 31 |
|
11 | | -permissions: |
12 | | - contents: read |
13 | | - id-token: write # Required for OIDC |
| 32 | +permissions: {} |
14 | 33 |
|
15 | 34 | 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 |
17 | 57 | runs-on: ubuntu-latest |
18 | 58 | environment: npm |
| 59 | + permissions: |
| 60 | + # Provenance generation in GitHub Actions requires "write" access to the "id-token" |
| 61 | + id-token: write |
19 | 62 | steps: |
20 | 63 | - 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 }} |
22 | 68 |
|
23 | 69 | - name: Setup Node.js |
24 | | - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 |
| 70 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
25 | 71 | with: |
26 | | - node-version: 24.15.0 |
| 72 | + node-version: 24.18.0 |
27 | 73 | package-manager-cache: false |
28 | 74 |
|
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 |
31 | 77 | with: |
32 | 78 | run_install: true |
33 | 79 |
|
34 | | - - name: Build Packages |
| 80 | + - name: Build |
35 | 81 | run: node --run build |
36 | 82 |
|
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