test npm publish by github action #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update_version | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'package.json' | |
jobs: | |
update_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20.x | |
- name: Root Install | |
run: npm i | |
- name: Publish | |
run: | | |
git pull | |
npm i | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
npm version patch | |
npm publish | |
git status | |
git add package* | |
git commit -m "Bump version to $(jq -r .version package.json) [skip ci]" | |
git push --set-upstream origin main --follow-tags | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |