-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.68 KB
/
Copy pathpublish.yml
File metadata and controls
56 lines (47 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Publish to npm
# Auto-trigger disabled — the `instanode-mcp` package isn't claimed on
# npmjs.org so every `npm publish` fails with 404 PUT. Parked per
# operator decision. Once the npm package is claimed (npm owner add
# from authorised account, or first manual publish), restore the
# push trigger by uncommenting the lines below.
on:
# push:
# branches: [master]
# paths: [package.json]
workflow_dispatch: {}
permissions:
contents: write
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Skip if version unchanged
id: check
run: |
LOCAL=$(node -p "require('./package.json').version")
REMOTE=$(npm view "$(node -p "require('./package.json').name")" version 2>/dev/null || echo none)
echo "local=$LOCAL remote=$REMOTE"
if [ "$LOCAL" = "$REMOTE" ]; then
echo "publish=false" >> "$GITHUB_OUTPUT"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
echo "version=$LOCAL" >> "$GITHUB_OUTPUT"
fi
- if: steps.check.outputs.publish == 'true'
run: npm ci
- if: steps.check.outputs.publish == 'true'
run: npm run build
- if: steps.check.outputs.publish == 'true'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- if: steps.check.outputs.publish == 'true'
run: |
git tag "v${{ steps.check.outputs.version }}"
git push origin "v${{ steps.check.outputs.version }}"