|
11 | 11 | - minor |
12 | 12 | - major |
13 | 13 | default: patch |
14 | | - dry_run: |
15 | | - description: 'Dry run (no push, no publish to npm)' |
16 | | - type: boolean |
17 | | - default: false |
18 | 14 |
|
19 | 15 | concurrency: |
20 | 16 | group: release |
21 | 17 | cancel-in-progress: false |
22 | 18 |
|
23 | 19 | jobs: |
24 | 20 | release: |
| 21 | + if: github.ref_name == 'staging' |
25 | 22 | runs-on: ubuntu-latest |
26 | 23 | permissions: |
27 | 24 | contents: write |
28 | 25 | id-token: write |
29 | 26 | steps: |
30 | | - - name: Verify branch (real releases only from staging) |
31 | | - if: inputs.dry_run == false |
| 27 | + - name: Verify staging branch |
32 | 28 | run: | |
33 | 29 | if [ "${{ github.ref_name }}" != "staging" ]; then |
34 | | - echo "::error::Real releases can only run from 'staging' (got: ${{ github.ref_name }}). Enable 'dry_run' to test from another branch." |
| 30 | + echo "::error::Releases can only be triggered from the 'staging' branch (got: ${{ github.ref_name }})" |
35 | 31 | exit 1 |
36 | 32 | fi |
37 | 33 |
|
38 | 34 | - uses: actions/checkout@v4 |
39 | 35 | with: |
| 36 | + ref: staging |
40 | 37 | fetch-depth: 0 |
41 | 38 |
|
42 | 39 | - uses: actions/setup-node@v4 |
|
59 | 56 | git add package.json package-lock.json dist/ |
60 | 57 | git commit -m "Packaging ${NEW_VERSION} with rebuilt /dist" |
61 | 58 | git tag "v${NEW_VERSION}" |
62 | | - echo "NEW_VERSION=${NEW_VERSION}" >> "$GITHUB_ENV" |
63 | 59 |
|
64 | 60 | - name: Push to GitHub |
65 | | - if: inputs.dry_run == false |
66 | | - run: git push origin ${{ github.ref_name }} --follow-tags |
67 | | - |
68 | | - - name: Publish to npm (dry run) |
69 | | - if: inputs.dry_run == true |
70 | | - run: npm publish --provenance --access public --dry-run |
| 61 | + run: git push origin staging --follow-tags |
71 | 62 |
|
72 | 63 | - name: Publish to npm with provenance |
73 | | - if: inputs.dry_run == false |
74 | 64 | run: npm publish --provenance --access public |
75 | | - |
76 | | - - name: Dry run summary |
77 | | - if: inputs.dry_run == true |
78 | | - run: | |
79 | | - echo "::notice::Dry run complete. Would publish v${NEW_VERSION}. No commits or tags pushed; nothing uploaded to npm." |
0 commit comments