Skip to content

Commit 1235a88

Browse files
committed
chore: add raw changeset validation and improve npm publishing process
1 parent 12ea47c commit 1235a88

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

.changeset/happy-rocks-share.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@addon-core/storage": patch
3+
---
4+
5+
add check for raw changeset files and improve npm publishing
6+
7+
- Added a pre-publish step in `release-publish.yml` to identify and prevent publishing with raw changeset files on the main branch.
8+
- Updated the publish action to use `npm run release`.
9+
- Enhanced `release-prepare.yml` to disable Husky and force push changes in branch preparation.

.changeset/violet-sheep-find.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/release-prepare.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ jobs:
5353
- name: Commit version & changelog changes into prep branch
5454
if: steps.changes.outputs.has_changes == 'true'
5555
uses: stefanzweifel/git-auto-commit-action@v5
56+
env:
57+
HUSKY: 0
5658
with:
5759
commit_message: "chore: version packages (prepare release)"
5860
commit_user_name: github-actions[bot]
5961
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
6062
branch: changeset/prepare-${{ github.ref_name }}
6163
create_branch: true
64+
push_options: --force-with-lease
6265

6366
- name: Open or update PR to release branch
6467
if: steps.changes.outputs.has_changes == 'true'

.github/workflows/release-publish.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,26 @@ jobs:
3232
- name: Install dependencies
3333
run: npm ci
3434

35-
- name: Create Release PR or Publish to npm
35+
- name: Ensure no raw changeset files on main
36+
id: check_changesets
37+
run: |
38+
if ls .changeset/*.md >/dev/null 2>&1; then
39+
echo "found=true" >> "$GITHUB_OUTPUT"
40+
echo "::error::Raw changeset files found on main. This indicates the prepare step wasn't applied in a release/* branch. Skipping publish to prevent auto PR creation. Remove or consume changesets via 'changeset version' in a release/* branch, then finish release." >&2
41+
else
42+
echo "found=false" >> "$GITHUB_OUTPUT"
43+
fi
44+
45+
- name: Create GitHub Release and Publish to npm via Changesets
46+
if: steps.check_changesets.outputs.found == 'false'
3647
uses: changesets/action@v1
3748
with:
38-
publish: npm publish --provenance --access public
49+
publish: npm run release
3950
createGithubReleases: true
4051
commitMode: github-api
4152
env:
4253
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4354
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4456
NPM_CONFIG_PROVENANCE: "true"
4557
HUSKY: 0

0 commit comments

Comments
 (0)