Skip to content

Commit 3a18446

Browse files
committed
fix: simplify release workflow — direct npm publish without changeset PR dance
Made-with: Cursor
1 parent 68ed194 commit 3a18446

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
push:
55
branches: [main]
66

7-
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
permissions:
8+
contents: read
89

910
jobs:
1011
release:
@@ -13,31 +14,28 @@ jobs:
1314

1415
steps:
1516
- uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
1817

1918
- uses: actions/setup-node@v4
2019
with:
2120
node-version: 20
2221
registry-url: https://registry.npmjs.org
2322

24-
- name: Install @changesets/cli
25-
run: npm install -g @changesets/cli
26-
2723
- name: Install dependencies
2824
run: npm install
2925

3026
- name: Build
3127
run: npm run build
3228

33-
- name: Create Release PR or Publish
34-
uses: changesets/action@v1
35-
with:
36-
publish: npx changeset publish
37-
version: npx changeset version
38-
title: "chore: release"
39-
commit: "chore: release"
29+
- name: Publish if version is new
30+
run: |
31+
PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)")
32+
CURRENT=$(node -e "console.log(require('./package.json').version)")
33+
PUBLISHED=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo "0.0.0")
34+
if [ "$CURRENT" != "$PUBLISHED" ]; then
35+
echo "Publishing $PACKAGE_NAME@$CURRENT (was $PUBLISHED on npm)"
36+
npm publish --access public
37+
else
38+
echo "Version $CURRENT already published, skipping"
39+
fi
4040
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4241
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43-

0 commit comments

Comments
 (0)