Skip to content

Commit

Permalink
ci: 更新 npm 发布流程
Browse files Browse the repository at this point in the history
- 修改工作流名称为 "Node.js Package"
- 将触发条件改为 release 创建时
- 更新 actions/checkout 版本为 v2
- 移除设置 node 步骤中的 registry-url
- 简化 npm publish 步骤并使用 NODE_AUTH_TOKEN 环境变量
  • Loading branch information
everfu committed Jan 12, 2025
1 parent 48085a4 commit ce7230a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
# .github/workflows/release.yml

name: Release

permissions:
contents: write
name: Node.js Package

on:
push:
tags:
- 'v*'
release:
types: [created]

jobs:
release:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set node
uses: actions/setup-node@v4
token: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/setup-node@v2
with:
registry-url: https://registry.npmjs.org/
node-version: lts/*

- run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- run: npm publish
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .github/workflows/release.yml

name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set node
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: lts/*

- run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit ce7230a

Please sign in to comment.