From 56ac3a89f2981045287f60862760a7ca0046657a Mon Sep 17 00:00:00 2001 From: liyepan Date: Fri, 23 Oct 2026 15:20:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20v0.12.5=20=E2=80=94=E2=80=94=20Release?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E5=8F=91=E5=B8=83=EF=BC=8CGitea=20?= =?UTF-8?q?=E4=B8=8A=E6=89=80=E6=9C=89=20job=20=E7=9B=B4=E6=8E=A5=E8=B7=B3?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 取消手动 publish 勾选:推 main / 打 tag / 手动 Run workflow 都会自动发 Release (PR 不发),仍然是 draft:false + Latest - 每个 job 加 github.server_url == 'https://github.com' 守卫: Gitea 里跑的 run 所有 job 都显示 skipped,不占 runner、不会发 Release - cancel-in-progress 改成 false,避免发布到一半被新 push 取消 - README 更新:自动发版说明 + Gitea 1.27 的三种关法(设置页/Actions 页/API) --- .github/workflows/packages.yml | 28 ++++++++++++++++------------ README.md | 31 +++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 6c4ce08..869027f 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -1,8 +1,10 @@ name: 安装包 # 同步到 GitHub 后,这里编译并打出: -# 注意:Gitea Actions 也会读 .github/workflows,不想在 Gitea 跑需要在 -# Gitea 仓库设置里禁用 Actions / 该工作流(详见 README「打包(安装包)」)。 +# 注意:Gitea Actions 也会读 .github/workflows,所以每个 job 都有 +# if: github.server_url == 'https://github.com' +# 的守卫,在 Gitea 上只会显示成 skipped,不占 runner;要连 run 都不出现, +# 需要在 Gitea 仓库设置里禁用 Actions / 该工作流(详见 README)。 # Linux deb / rpm(x86_64、aarch64) # Windows 安装包(关联 .md)+ 便携 zip # macOS arm64 / x86_64 两个 dmg(未签名,不是公证版) @@ -12,18 +14,14 @@ on: tags: ["v*"] pull_request: workflow_dispatch: - inputs: - publish: - description: "发布 Release(用 v<版本> 当 tag,不必先打 tag)" - type: boolean - default: false permissions: contents: write concurrency: group: packages-${{ github.ref }} - cancel-in-progress: true + # 不要把正在发 Release 的 run 掐掉,否则可能留下半截草稿 + cancel-in-progress: false env: QT_VERSION: "5.15.2" @@ -31,6 +29,8 @@ env: jobs: linux: name: Linux ${{ matrix.arch }} + # Gitea 也会读这个文件;非 github.com 的 server 直接跳过,别占 Gitea 的 runner + if: ${{ github.server_url == 'https://github.com' }} runs-on: ${{ matrix.runs-on }} continue-on-error: ${{ matrix.optional }} timeout-minutes: 30 @@ -106,6 +106,7 @@ jobs: windows: name: Windows x86_64 + if: ${{ github.server_url == 'https://github.com' }} runs-on: windows-2022 timeout-minutes: 40 steps: @@ -217,6 +218,7 @@ jobs: macos-arm64: name: macOS arm64 (Apple Silicon) + if: ${{ github.server_url == 'https://github.com' }} runs-on: macos-15 timeout-minutes: 50 env: @@ -287,6 +289,7 @@ jobs: macos-x86_64: name: macOS x86_64 (Intel) # Intel 的 GitHub runner;拿不到这个 runner 时这一步会失败,不影响其它产物 + if: ${{ github.server_url == 'https://github.com' }} runs-on: macos-15-intel timeout-minutes: 40 steps: @@ -352,11 +355,12 @@ jobs: needs: [linux, windows, macos-arm64, macos-x86_64] # 打 tag 或手动勾 publish 才发;普通推送/PR 只留 artifact。 # always() 是为了某个平台失败时其它产物还能发出来。 + # 推 main / 打 tag / 手动运行都自动发 Release(PR 不发); + # 非 github.com(比如 Gitea)直接跳过。always() 保证某个平台失败时其它产物还能发。 if: >- - always() && ( - startsWith(github.ref, 'refs/tags/') || - (github.event_name == 'workflow_dispatch' && inputs.publish) - ) + always() && !cancelled() && + github.server_url == 'https://github.com' && + (github.event_name == 'push' || github.event_name == 'workflow_dispatch') runs-on: ubuntu-24.04 timeout-minutes: 10 steps: diff --git a/README.md b/README.md index 19d0954..11c03bc 100644 --- a/README.md +++ b/README.md @@ -210,13 +210,23 @@ make -C build install INSTALL_ROOT=/tmp/pkg # 打包用,装到 /tmp/pkg/usr/lo `.github/workflows/packages.yml` 是给 GitHub 镜像用的:推代码、打 tag、PR 或手动运行时编译, 并打出下面这些安装包。 -> **Gitea 也会读这个目录**:Gitea Actions 兼容 GitHub,默认同时扫描 `.gitea/workflows` 和 -> `.github/workflows`,光靠 YAML 没法让 Gitea 忽略它。要它不在 Gitea 跑,三选一: -> -> - 仓库 **设置 → 高级设置** 里取消「启用 Actions」:整个仓库的 Actions 都停,GitHub 不受影响 -> - 或 **Actions → 安装包 → 禁用工作流**:只停这一个(Gitea 1.22+) -> - 或服务器 `app.ini` 里设 `[actions] WORKFLOW_DIRS = .gitea/workflows`:Gitea 只读 -> `.gitea/workflows`,`.github/workflows` 就只对 GitHub 生效(需要支持该配置的版本) +**Gitea 也会读这个目录**:Gitea Actions 兼容 GitHub,默认同时扫描 `.gitea/workflows` 和 +`.github/workflows`。工作流里每个 job 都加了 `github.server_url == 'https://github.com'` 的守卫, +在 Gitea 上只会显示 skipped、不占 runner;要连 Actions 列表里的 run 都不出现,任选一个: + +- 仓库 **设置 → Actions → General**,取消勾选 **Enable Actions** 后保存(整个仓库的 Actions 全停) +- 或 **Actions → 安装包** 页面点 **Disable Workflow**(只停这一个工作流) +- 或服务器 `app.ini` 里设 `[actions] WORKFLOW_DIRS = .gitea/workflows`,Gitea 就只读 + `.gitea/workflows`,`.github/workflows` 只对 GitHub 生效 + +Gitea 1.27 也可以直接调 API(`TOKEN` 换成你的访问令牌,`` 用列表里返回的值): + +```bash +curl -H "Authorization: token $TOKEN" \ + https://git.linuxacme.com/api/v1/repos/liyepan/VoiletMark/actions/workflows +curl -X PUT -H "Authorization: token $TOKEN" \ + https://git.linuxacme.com/api/v1/repos/liyepan/VoiletMark/actions/workflows//disable +``` | 平台 | runner | 产物 | | --- | --- | --- | @@ -239,9 +249,10 @@ make -C build install INSTALL_ROOT=/tmp/pkg # 打包用,装到 /tmp/pkg/usr/lo ### 发 Release -- 打 tag:`git tag v0.12.5 && git push origin v0.12.4`(同步到 GitHub 时把 tag 一起推过去) -- 不打 tag:**Actions → 安装包 → Run workflow**,勾上 **publish**,会用 `v<版本>` 当 tag -- 普通推送 / PR 只上传 artifact,不发 Release——「发布到 Release」显示 skipped 是正常的 +- 推 main、打 tag、手动 Run workflow 都会**自动发 Release**(PR 不发) +- tag 用 `v<版本>`,版本号在 `VoiletMark.pro` 的 `VERSION` 里;同一版本多次推送会更新同一个 Release 的安装包 +- 想发新版本就改 `VERSION`,下一次推送会自动建 `v<新版本>` 的 Release +- Release 是正式发布(不是草稿 / 预发布),并设为 Latest ### 本地打包(Linux)