Skip to content

Commit 30cf660

Browse files
committed
Validate first the changes
1 parent 8d1fa5c commit 30cf660

2 files changed

Lines changed: 31 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,29 @@ on:
1111
- minor
1212
- major
1313
default: patch
14-
dry_run:
15-
description: 'Dry run (no push, no publish to npm)'
16-
type: boolean
17-
default: false
1814

1915
concurrency:
2016
group: release
2117
cancel-in-progress: false
2218

2319
jobs:
2420
release:
21+
if: github.ref_name == 'staging'
2522
runs-on: ubuntu-latest
2623
permissions:
2724
contents: write
2825
id-token: write
2926
steps:
30-
- name: Verify branch (real releases only from staging)
31-
if: inputs.dry_run == false
27+
- name: Verify staging branch
3228
run: |
3329
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 }})"
3531
exit 1
3632
fi
3733
3834
- uses: actions/checkout@v4
3935
with:
36+
ref: staging
4037
fetch-depth: 0
4138

4239
- uses: actions/setup-node@v4
@@ -59,21 +56,9 @@ jobs:
5956
git add package.json package-lock.json dist/
6057
git commit -m "Packaging ${NEW_VERSION} with rebuilt /dist"
6158
git tag "v${NEW_VERSION}"
62-
echo "NEW_VERSION=${NEW_VERSION}" >> "$GITHUB_ENV"
6359
6460
- 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
7162

7263
- name: Publish to npm with provenance
73-
if: inputs.dry_run == false
7464
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."

.github/workflows/validate.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Validate build
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- staging
7+
pull_request:
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version-file: '.nvmrc'
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- run: npm ci
21+
22+
- name: Build /dist
23+
run: npm run build
24+
25+
- name: Validate npm package (dry-run)
26+
run: npm publish --dry-run

0 commit comments

Comments
 (0)