Skip to content

Commit a401d22

Browse files
committed
CI: skip npm publish when version exists
1 parent 36112c6 commit a401d22

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install pnpm
1515
uses: pnpm/action-setup@v4
1616
with:
17-
version: 9
17+
version: 10
1818

1919
- name: Setup Node.js
2020
uses: actions/setup-node@v4
@@ -27,14 +27,32 @@ jobs:
2727
run: pnpm install --frozen-lockfile
2828

2929
- name: Run tests
30-
run: pnpm test
30+
run: pnpm test -- --watchman=false
3131
continue-on-error: true
32+
33+
- name: Get package version
34+
id: pkg
35+
run: echo "version=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
36+
37+
- name: Check npm version
38+
id: npm
39+
run: |
40+
if npm view @halilertekin/claude-code-router-config@${{ steps.pkg.outputs.version }} version >/dev/null 2>&1; then
41+
echo "published=true" >> $GITHUB_OUTPUT
42+
else
43+
echo "published=false" >> $GITHUB_OUTPUT
44+
fi
3245
3346
- name: Publish to npm
47+
if: steps.npm.outputs.published != 'true'
3448
run: npm publish --access public
3549
env:
3650
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
3751

52+
- name: Skip publish (already on npm)
53+
if: steps.npm.outputs.published == 'true'
54+
run: echo "Version already published, skipping npm publish."
55+
3856
- name: Create Release
3957
uses: softprops/action-gh-release@v2
4058
with:

0 commit comments

Comments
 (0)