File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release to npm
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ release :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : read
13+ id-token : write
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - name : Check if version changed
18+ id : version-check
19+ run : |
20+ PACKAGE_VERSION=$(jq -r '.version' package.json)
21+ NPM_VERSION=$(npm view @ampcode/svelte-check-daemon version 2>/dev/null || echo "0.0.0")
22+ if [ "$PACKAGE_VERSION" != "$NPM_VERSION" ]; then
23+ echo "changed=true" >> $GITHUB_OUTPUT
24+ echo "Version changed: $NPM_VERSION -> $PACKAGE_VERSION"
25+ else
26+ echo "changed=false" >> $GITHUB_OUTPUT
27+ echo "Version unchanged: $PACKAGE_VERSION"
28+ fi
29+
30+ - name : Setup pnpm
31+ if : steps.version-check.outputs.changed == 'true'
32+ uses : pnpm/action-setup@v4
33+
34+ - name : Setup Node.js
35+ if : steps.version-check.outputs.changed == 'true'
36+ uses : actions/setup-node@v4
37+ with :
38+ node-version : 20
39+ registry-url : https://registry.npmjs.org
40+
41+ - name : Install dependencies
42+ if : steps.version-check.outputs.changed == 'true'
43+ run : pnpm install
44+
45+ - name : Publish to npm
46+ if : steps.version-check.outputs.changed == 'true'
47+ run : pnpm publish --access public --no-git-checks
You can’t perform that action at this time.
0 commit comments