From 63a38dce49ba109f61607994e21ba921d8e970e9 Mon Sep 17 00:00:00 2001 From: Jin Mao Date: Thu, 21 May 2026 09:07:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(workflow):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 简化触发条件,移除冗余的推送事件配置 - 更新标签创建输入参数描述,明确格式要求 - 移除 Husky 环境变量配置 - 重命名构建作业为发布作业,提高语义清晰度 - 移除 Node.js 版本矩阵策略配置 - 优化版本提取逻辑,支持工作流调度和推送事件 - 统一标签前缀处理,确保版本格式一致性 - 移除注释掉的冗余步骤配置 - 简化发布配置,移除不必要的发布操作注释块 --- .github/workflows/release-tag.yml | 72 ++++++++----------------------- 1 file changed, 18 insertions(+), 54 deletions(-) diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 3afed1f8f..a745510c0 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -3,66 +3,44 @@ name: Create Release Tag on: push: tags: - - 'v*.*.*' # Push events to matching v*, i.e. v1.0, v20.15.10 + - 'v*.*.*' workflow_dispatch: inputs: tag: - description: 'Tag to create' + description: 'Tag to create (e.g. v1.2.3)' required: true - default: 'staging' - -env: - HUSKY: '0' + type: string permissions: - pull-requests: write contents: write jobs: - build: + release: name: Create Release if: github.repository == 'vbenjs/vue-vben-admin' runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22] steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 0 - # - name: Checkout code - # uses: actions/checkout@v6 - # with: - # fetch-depth: 0 - - # - name: Install pnpm - # uses: pnpm/action-setup@v4 - - # - name: Use Node.js ${{ matrix.node-version }} - # uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node-version }} - # cache: "pnpm" - - # - name: Install dependencies - # run: pnpm install --frozen-lockfile - - # - name: Test and Build - # run: | - # pnpm run test - # pnpm run build - - - name: version + - name: Extract version id: version run: | - tag=${GITHUB_REF/refs\/tags\//} - version=${tag#v} - major=${version%%.*} - echo "tag=${tag}" >> $GITHUB_OUTPUT - echo "version=${version}" >> $GITHUB_OUTPUT - echo "major=${major}" >> $GITHUB_OUTPUT + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + raw_tag="${{ inputs.tag }}" + else + raw_tag="${GITHUB_REF_NAME}" + fi + # Normalize: ensure v prefix + tag="${raw_tag}" + [[ "${tag:0:1}" != "v" ]] && tag="v${tag}" + version="${tag#v}" + major="${version%%.*}" + echo "tag=${tag}" >> "${GITHUB_OUTPUT}" + echo "version=${version}" >> "${GITHUB_OUTPUT}" + echo "major=${major}" >> "${GITHUB_OUTPUT}" - uses: release-drafter/release-drafter@v7 with: @@ -70,17 +48,3 @@ jobs: publish: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: force update major tag - # run: | - # git tag v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }} -f - # git push origin refs/tags/v${{ steps.version.outputs.major }} -f - - # - name: Create Release for Tag - # id: release_tag - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # generateReleaseNotes: "true" - # body: | - # > Please refer to [CHANGELOG.md](https://github.com/vbenjs/vue-vben-admin/blob/main/CHANGELOG.md) for details.