File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010jobs :
1111 publish :
1212 runs-on : ubuntu-latest
13+
1314 permissions :
14- contents : write
15+ contents : write
1516
1617 steps :
1718 - name : Checkout code
@@ -29,12 +30,39 @@ jobs:
2930 - name : Install dependencies
3031 run : npm ci
3132
32- - name : Run tests
33+ - name : Run tests (fixed)
3334 run : npm test -- --passWithNoTests
3435
3536 - name : Build package
3637 run : npm run build
3738
39+ - name : Conditional version bump and publish
40+ run : |
41+ if [[ ${{ github.ref }} == refs/heads/master ]]; then
42+ git config user.name 'GitHub Actions'
43+ git config user.email 'actions@github.com'
44+ fi
45+
46+ if [[ ${{ github.ref }} == refs/tags/* ]]; then
47+ echo "Tag push/Release detected: Publishing without version bump."
48+ npm publish --access public
49+ elif [[ ${{ github.ref }} == refs/heads/master ]]; then
50+ echo "Master branch push detected: Bumping version and publishing."
51+
52+ npm version patch -m "ci: bump version to %s [skip ci]"
53+ npm publish --access public
54+ else
55+ echo "Not master or a tag. Skipping publish."
56+ fi
57+ env :
58+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
59+
60+ - name : Push version changes
61+ if : github.ref == 'refs/heads/master'
62+ run : git push origin master --follow-tags
63+ env :
64+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
65+
3866 - name : Conditional version bump and publish
3967
4068 run : |
You can’t perform that action at this time.
0 commit comments