Skip to content

Commit

Permalink
chore: 🤖 Version Check
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaohaoyang committed Jun 5, 2024
1 parent d0ad8d0 commit 3e9c69d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,39 @@ jobs:
# 指定操作系统为'ubuntu-latest'
runs-on: ubuntu-latest
steps:
- name: Check if version updated
uses: MontyD/package-json-updated-action@1.0.1
id: version-updated
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 检查仓库以便作业能正常访问
- name: Version Check
id: check
uses: EndBug/version-check@v2

- name: Setup repo
uses: actions/checkout@v4
if: steps.version-updated.outputs.has-updated
if: steps.check.outputs.changed == 'true'
with:
fetch-depth: 2

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: latest
if: steps.version-updated.outputs.has-updated
if: steps.check.outputs.changed == 'true'

- name: Node env setup
uses: actions/setup-node@v4
if: steps.version-updated.outputs.has-updated
if: steps.check.outputs.changed == 'true'
with:
node-version: lts/*
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- run: pnpm i
if: steps.version-updated.outputs.has-updated
if: steps.check.outputs.changed == 'true'
# 发布命令
- run: pnpm run build && pnpm publish
if: steps.version-updated.outputs.has-updated
if: steps.check.outputs.changed == 'true'
env:
# npm_token 就是刚刚填写 token 时取的名字
NODE_AUTH_TOKEN: ${{ secrets.NPMPUBHAOYANG }}
NPM_CONFIG_PROVENANCE: true
- name: Create a tag
uses: salsify/action-detect-and-tag-new-version@v2
if: steps.version-updated.outputs.has-updated
if: steps.check.outputs.changed == 'true'

0 comments on commit 3e9c69d

Please sign in to comment.