From 60dbb8a55938af3243db26b0e94062f1414d52cd Mon Sep 17 00:00:00 2001 From: Syngnat Date: Thu, 9 Apr 2026 13:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?dev=20=E9=A2=84=E5=8F=91=E5=B8=83=E6=9E=84=E5=BB=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=E5=B9=B6=E6=94=B6=E6=95=9B=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为 dev-build workflow 增加同分支并发互斥配置 - 避免多个 dev 运行同时操作 dev-latest release - 新增构建时间格式化步骤,将时间统一输出为 yyyy-MM-dd HH:mm:ss - 将 release 文案中的构建时间改为引用格式化结果 - 保持现有 dev 版本号与 release/tag 清理逻辑不变 --- .github/workflows/dev-build.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 92016ce..1fac8a9 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -5,6 +5,10 @@ on: branches: - dev +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + permissions: contents: write @@ -575,6 +579,20 @@ jobs: DEV_VERSION="dev-${SHORT_SHA}" echo "version=${DEV_VERSION}" >> "$GITHUB_OUTPUT" + - name: Format Build Time + id: build_time + shell: bash + run: | + python3 - <<'PY' >> "$GITHUB_OUTPUT" + from datetime import datetime, timezone, timedelta + + raw = "${{ github.event.head_commit.timestamp }}" + dt = datetime.fromisoformat(raw) + china_tz = timezone(timedelta(hours=8)) + formatted = dt.astimezone(china_tz).strftime("%Y-%m-%d %H:%M:%S") + print(f"display={formatted}") + PY + # 删除旧的 dev pre-release(保持只有最新一个) - name: Reset Previous Dev Release uses: actions/github-script@v7 @@ -635,7 +653,7 @@ jobs: **版本**: `${{ steps.version.outputs.version }}` **分支**: `dev` **提交**: [`${{ github.sha }}`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) - **构建时间**: ${{ github.event.head_commit.timestamp }} + **构建时间**: ${{ steps.build_time.outputs.display }} > ⚠️ 这是开发测试版本,仅供内部测试使用,不建议用于生产环境。 > 每次 push 到 `dev` 分支会自动覆盖此 release。