Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c100973590 | ||
|
|
957656ad5b | ||
|
|
02c9c7af3c | ||
|
|
0b4b4b0c03 | ||
|
|
f89b14ea7d |
@@ -3,42 +3,31 @@ name: Publish to npm
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- "*"
|
||||||
workflow_dispatch:
|
permissions:
|
||||||
|
id-token: write # Required for OIDC
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: release # npm Trusted Publisher 环境
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write # OIDC 认证
|
|
||||||
contents: read # 读取仓库
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v6
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0 # 完整 history 用于版本分析
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
- uses: actions/setup-node@v6
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: "24"
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
# 从 tag 提取版本号
|
|
||||||
- name: Get version from tag
|
- name: Get version from tag
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
VERSION="${GITHUB_REF#refs/tags/}"
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "Package version: $VERSION"
|
|
||||||
|
|
||||||
# 修改 package.json 版本号
|
|
||||||
- name: Update package.json version
|
- name: Update package.json version
|
||||||
run: |
|
run: npm pkg set version=${{ steps.version.outputs.version }}
|
||||||
npm pkg set version=${{ steps.version.outputs.version }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -46,17 +35,5 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
# Trusted Publisher 发布(无需 token)
|
|
||||||
- name: Publish to npm
|
- name: Publish to npm
|
||||||
run: npm publish --access public
|
run: npm publish --access public
|
||||||
|
|
||||||
- name: Create GitHub Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
body: |
|
|
||||||
## @simcu/simapi v${{ steps.version.outputs.version }}
|
|
||||||
|
|
||||||
See [changelog](https://github.com/simcu/simapi-vue/releases) for details.
|
|
||||||
draft: false
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user