🔧 修复npm认证配置,参考DPML项目设置 - 添加NODE_AUTH_TOKEN环境变量 - 配置registry-url - 使用pnpm发布 - 添加测试脚本和文档
This commit is contained in:
9
.github/workflows/snapshot.yml
vendored
9
.github/workflows/snapshot.yml
vendored
@ -27,6 +27,7 @@ jobs:
|
||||
with:
|
||||
node-version: '20.x'
|
||||
cache: 'pnpm'
|
||||
registry-url: 'https://registry.npmjs.org/'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
@ -39,9 +40,6 @@ jobs:
|
||||
# 确保在正确的分支
|
||||
git checkout develop
|
||||
|
||||
# 配置npm认证
|
||||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
||||
|
||||
# 获取当前时间戳和短commit hash
|
||||
TIMESTAMP=$(date +%Y%m%d%H%M%S)
|
||||
SHORT_COMMIT=$(git rev-parse --short HEAD)
|
||||
@ -57,14 +55,15 @@ jobs:
|
||||
# 直接设置版本号
|
||||
npm version $SNAPSHOT_VERSION --no-git-tag-version
|
||||
|
||||
# 发布snapshot版本
|
||||
npm publish --tag snapshot
|
||||
# 使用pnpm发布snapshot版本(与DPML项目保持一致)
|
||||
pnpm publish --tag snapshot --no-git-checks
|
||||
|
||||
# 输出版本信息供后续步骤使用
|
||||
echo "SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> $GITHUB_ENV
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Comment on related PRs
|
||||
if: success()
|
||||
|
||||
Reference in New Issue
Block a user