File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ name : build and publish
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ permissions :
9+ id-token : write
10+
11+ jobs :
12+ bp :
13+ name : build and publish to npmjs
14+ runs-on : ubuntu-22.04
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 2
21+
22+ - name : Check if version changed
23+ id : version-check
24+ run : |
25+ if git diff HEAD^ HEAD -- package.json | grep -q '"version"'; then
26+ echo "changed=true" >> $GITHUB_OUTPUT
27+ else
28+ echo "changed=false" >> $GITHUB_OUTPUT
29+ fi
30+
31+ - name : Setup Node.js
32+ if : steps.version-check.outputs.changed == 'true'
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : " 20"
36+ registry-url : " https://registry.npmjs.org"
37+
38+ - name : Setup pnpm
39+ if : steps.version-check.outputs.changed == 'true'
40+ uses : pnpm/action-setup@v4
41+ with :
42+ version : 9
43+
44+ - name : install
45+ if : steps.version-check.outputs.changed == 'true'
46+ run : pnpm install --frozen-lockfile
47+
48+ - name : build and publish
49+ if : steps.version-check.outputs.changed == 'true'
50+ working-directory : ./
51+ run : |
52+ pnpm build
53+ npm publish --access public --provenance
54+ env :
55+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments