Skip to content

Workflow file for this run

name: Publish to npm
on:
push:
branches:
- chao/auto-npm-publish
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Update version
id: version
run: |
npm version patch --no-git-tag-version
echo "new_version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Publish to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # 设置 npm token
run: npm publish --access public