Add improvements #14
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: Publish to npm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, '@publish') | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '22.8.0' | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- run: pnpm install | |
- name: Commit changes if any | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
if [[ `git status --porcelain` ]]; then | |
git add . | |
git commit -m "Auto-commit: Save uncommitted changes before versioning" | |
fi | |
- run: npm version patch -m "Upgrade version to %s [skip ci]" | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |