File tree Expand file tree Collapse file tree 2 files changed +8
-44
lines changed
Expand file tree Collapse file tree 2 files changed +8
-44
lines changed Original file line number Diff line number Diff line change 88
99jobs :
1010 test :
11- runs-on : ${{ matrix.os }}
11+ runs-on : ubuntu-latest
1212 strategy :
1313 matrix :
14- os : [ubuntu-latest, windows-latest, macos-latest]
1514 node-version : [18, 20, 22]
1615
1716 steps :
3231 run : npm test
3332
3433 - name : Upload coverage
35- if : matrix.os == 'ubuntu-latest' && matrix. node-version == 20
34+ if : matrix.node-version == 20
3635 uses : actions/upload-artifact@v4
3736 with :
3837 name : coverage-report
3938 path : coverage/
4039
41- publish :
42- needs : test
43- runs-on : ubuntu-latest
44- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
45- permissions :
46- contents : read
47- id-token : write
48-
49- steps :
50- - uses : actions/checkout@v4
51-
52- - uses : actions/setup-node@v4
53- with :
54- node-version : 20
55- registry-url : ' https://registry.npmjs.org'
56-
57- - run : npm ci
58- - run : npm run build
59- - run : npm test
60-
61- # Only publish if version changed
62- - name : Check if version changed
63- id : version
64- run : |
65- PUBLISHED=$(npm view schema-sentinel version 2>/dev/null || echo "0.0.0")
66- CURRENT=$(node -p "require('./package.json').version")
67- echo "published=$PUBLISHED" >> $GITHUB_OUTPUT
68- echo "current=$CURRENT" >> $GITHUB_OUTPUT
69- if [ "$PUBLISHED" != "$CURRENT" ]; then
70- echo "changed=true" >> $GITHUB_OUTPUT
71- else
72- echo "changed=false" >> $GITHUB_OUTPUT
73- fi
74-
75- - name : Publish to npm
76- if : steps.version.outputs.changed == 'true'
77- run : npm publish --provenance --access public
78- env :
79- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
80-
Original file line number Diff line number Diff line change @@ -40,12 +40,17 @@ jobs:
4040 git config user.email "github-actions[bot]@users.noreply.github.com"
4141
4242 - name : Bump version
43- run : npm version ${{ inputs.version }} -m "release: v%s"
43+ id : version
44+ run : |
45+ npm version ${{ inputs.version }} -m "release: v%s"
46+ NEW_VERSION=$(node -p "require('./package.json').version")
47+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
4448
4549 - name : Push tag
4650 run : git push origin main --tags
4751
4852 - name : Publish to npm
53+ if : secrets.NPM_TOKEN != ''
4954 run : npm publish --provenance --access public
5055 env :
5156 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments