Compare commits

...
4 Commits
Author SHA1 Message Date
xrain 957656ad5b fix ci
Publish to npm / publish (push) Failing after 2m22s
2026-03-31 06:50:18 +08:00
xrain 02c9c7af3c fix ci
Publish to npm / publish (push) Failing after 2m27s
2026-03-31 06:47:38 +08:00
xrain 0b4b4b0c03 fix ci 2026-03-31 06:46:34 +08:00
xrain f89b14ea7d fix: remove environment 2026-03-31 06:44:36 +08:00
+8 -21
View File
@@ -3,42 +3,33 @@ name: Publish to npm
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
- "*"
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
publish:
runs-on: ubuntu-latest
environment: release # npm Trusted Publisher 环境
permissions:
id-token: write # OIDC 认证
contents: read # 读取仓库
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # 完整 history 用于版本分析
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
node-version: "20"
registry-url: "https://registry.npmjs.org"
# 从 tag 提取版本号
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
VERSION="${GITHUB_REF#refs/tags/}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Package version: $VERSION"
# 修改 package.json 版本号
- name: Update package.json version
run: |
npm pkg set version=${{ steps.version.outputs.version }}
run: npm pkg set version=${{ steps.version.outputs.version }}
- name: Install dependencies
run: npm ci
@@ -46,7 +37,6 @@ jobs:
- name: Build
run: npm run build
# Trusted Publisher 发布(无需 token
- name: Publish to npm
run: npm publish --access public
@@ -55,8 +45,5 @@ jobs:
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 }}