Skip to content

Commit

Permalink
Enhance npm publish workflow and add release script
Browse files Browse the repository at this point in the history
- Add `release` script to package.json for simplified version management
- Update GitHub Actions publish workflow with npm authentication
- Configure standard-version to generate minor version bump
- Modify npm publish command to ignore scripts and use npm token
  • Loading branch information
aindong committed Jan 30, 2025
1 parent f1093fc commit a988784
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ jobs:
- name: Version and Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
# Authenticate with npm
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
# Bump version and generate changelog
npx standard-version
npx standard-version --release-as minor --skip.tag true
# Publish to npm
npm publish --access public
npm publish --access public --ignore-scripts
# Push version bump
git push --follow-tags origin main
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build": "tsc",
"dev": "ts-node src/index.ts",
"prepublishOnly": "npm run build",
"release": "standard-version && git push --follow-tags origin main",
"test": "echo \"Error: no test specified\" && exit 1"
},
"files": [
Expand Down

0 comments on commit a988784

Please sign in to comment.