Files
PromptX/.github/workflows/alpha.yml
Workflow config file is invalid. Please check your config file: yaml: unmarshal errors: line 9: cannot unmarshal !!str `${{ git...` into model.RawConcurrency
sean 8f592cb880 fix: 修复Alpha Release工作流分支配置错误
## 问题描述
Alpha Release工作流错误地配置为在develop分支触发,导致:
- develop分支同时触发Snapshot Release和Alpha Release
- 违背了标准分支策略:develop→snapshot, test→alpha

## 修复内容
- 将Alpha Release触发分支从develop改为test
- 更新工作流中的git checkout命令从develop改为test
- 修正PR查找逻辑从develop分支改为test分支
- 更新注释说明从develop改为test分支

## 修复后的分支策略
- develop分支 → Snapshot Release 
- test分支 → Alpha Release 
- staging分支 → Beta Release 
- main分支 → Production Release 

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 07:29:56 +08:00

112 lines
3.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Alpha Release
on:
push:
branches:
- test
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
alpha:
name: Alpha Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm run test:ci
- name: Release alpha version
run: |
# 确保在正确的分支
git checkout test
# 获取当前时间戳和短commit hash
TIMESTAMP=$(date +%Y%m%d%H%M%S)
SHORT_COMMIT=$(git rev-parse --short HEAD)
# 读取当前版本,移除任何现有的预发布标识
CURRENT_VERSION=$(node -p "require('./package.json').version.split('-')[0]")
# 生成唯一的alpha版本号base-alpha.timestamp.commit
ALPHA_VERSION="${CURRENT_VERSION}-alpha.${TIMESTAMP}.${SHORT_COMMIT}"
echo "生成alpha版本号: $ALPHA_VERSION"
# 直接设置版本号
npm version $ALPHA_VERSION --no-git-tag-version
# 使用pnpm发布alpha版本
pnpm publish --tag alpha --no-git-checks
# 输出版本信息供后续步骤使用
echo "ALPHA_VERSION=$ALPHA_VERSION" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
- name: Comment on related PRs
if: success()
uses: actions/github-script@v7
with:
script: |
const { execSync } = require('child_process');
// 获取alpha版本号
const version = process.env.ALPHA_VERSION;
// 查找相关的PR
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
base: 'test'
});
const comment = `🚀 **Alpha版本已发布!**
📦 版本号: \`${version}\`
🔗 安装命令: \`npx dpml-prompt@${version} <command>\`
或者: \`npx dpml-prompt@alpha <command>\`
📚 使用示例:
\`\`\`bash
npx dpml-prompt@${version} hello
npx dpml-prompt@${version} init
npx dpml-prompt@${version} action <roleId>
\`\`\`
💡 你可以使用这个alpha版本测试最新的test分支功能。
⚠️ **迁移提示**: 推荐使用 \`@alpha\` 替代 \`@snapshot\` 进行开发测试。`;
// 为每个相关PR添加评论
for (const pr of prs) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: comment
});
}