feat: v0.12.5 —— Release 自动发布,Gitea 上所有 job 直接跳过
安装包 / Linux aarch64 (push) Canceled after 0s
安装包 / Linux x86_64 (push) Canceled after 0s
安装包 / Windows x86_64 (push) Canceled after 0s
安装包 / macOS arm64 (Apple Silicon) (push) Canceled after 0s
安装包 / macOS x86_64 (Intel) (push) Canceled after 0s
安装包 / 发布到 Release (push) Canceled after 0s

- 取消手动 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)
This commit is contained in:
2026-10-23 15:20:31 +08:00
parent bfee50c7f0
commit 56ac3a89f2
2 changed files with 37 additions and 22 deletions
+16 -12
View File
@@ -1,8 +1,10 @@
name: 安装包 name: 安装包
# 同步到 GitHub 后,这里编译并打出: # 同步到 GitHub 后,这里编译并打出:
# 注意:Gitea Actions 也会读 .github/workflows,不想在 Gitea 跑需要在 # 注意:Gitea Actions 也会读 .github/workflows,所以每个 job 都有
# Gitea 仓库设置里禁用 Actions / 该工作流(详见 README「打包(安装包)」)。 # if: github.server_url == 'https://github.com'
# 的守卫,在 Gitea 上只会显示成 skipped,不占 runner;要连 run 都不出现,
# 需要在 Gitea 仓库设置里禁用 Actions / 该工作流(详见 README)。
# Linux deb / rpm(x86_64、aarch64) # Linux deb / rpm(x86_64、aarch64)
# Windows 安装包(关联 .md)+ 便携 zip # Windows 安装包(关联 .md)+ 便携 zip
# macOS arm64 / x86_64 两个 dmg(未签名,不是公证版) # macOS arm64 / x86_64 两个 dmg(未签名,不是公证版)
@@ -12,18 +14,14 @@ on:
tags: ["v*"] tags: ["v*"]
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
inputs:
publish:
description: "发布 Release(用 v<版本> 当 tag,不必先打 tag)"
type: boolean
default: false
permissions: permissions:
contents: write contents: write
concurrency: concurrency:
group: packages-${{ github.ref }} group: packages-${{ github.ref }}
cancel-in-progress: true # 不要把正在发 Release 的 run 掐掉,否则可能留下半截草稿
cancel-in-progress: false
env: env:
QT_VERSION: "5.15.2" QT_VERSION: "5.15.2"
@@ -31,6 +29,8 @@ env:
jobs: jobs:
linux: linux:
name: Linux ${{ matrix.arch }} name: Linux ${{ matrix.arch }}
# Gitea 也会读这个文件;非 github.com 的 server 直接跳过,别占 Gitea 的 runner
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
continue-on-error: ${{ matrix.optional }} continue-on-error: ${{ matrix.optional }}
timeout-minutes: 30 timeout-minutes: 30
@@ -106,6 +106,7 @@ jobs:
windows: windows:
name: Windows x86_64 name: Windows x86_64
if: ${{ github.server_url == 'https://github.com' }}
runs-on: windows-2022 runs-on: windows-2022
timeout-minutes: 40 timeout-minutes: 40
steps: steps:
@@ -217,6 +218,7 @@ jobs:
macos-arm64: macos-arm64:
name: macOS arm64 (Apple Silicon) name: macOS arm64 (Apple Silicon)
if: ${{ github.server_url == 'https://github.com' }}
runs-on: macos-15 runs-on: macos-15
timeout-minutes: 50 timeout-minutes: 50
env: env:
@@ -287,6 +289,7 @@ jobs:
macos-x86_64: macos-x86_64:
name: macOS x86_64 (Intel) name: macOS x86_64 (Intel)
# Intel 的 GitHub runner;拿不到这个 runner 时这一步会失败,不影响其它产物 # Intel 的 GitHub runner;拿不到这个 runner 时这一步会失败,不影响其它产物
if: ${{ github.server_url == 'https://github.com' }}
runs-on: macos-15-intel runs-on: macos-15-intel
timeout-minutes: 40 timeout-minutes: 40
steps: steps:
@@ -352,11 +355,12 @@ jobs:
needs: [linux, windows, macos-arm64, macos-x86_64] needs: [linux, windows, macos-arm64, macos-x86_64]
# 打 tag 或手动勾 publish 才发;普通推送/PR 只留 artifact。 # 打 tag 或手动勾 publish 才发;普通推送/PR 只留 artifact。
# always() 是为了某个平台失败时其它产物还能发出来。 # always() 是为了某个平台失败时其它产物还能发出来。
# 推 main / 打 tag / 手动运行都自动发 Release(PR 不发);
# 非 github.com(比如 Gitea)直接跳过。always() 保证某个平台失败时其它产物还能发。
if: >- if: >-
always() && ( always() && !cancelled() &&
startsWith(github.ref, 'refs/tags/') || github.server_url == 'https://github.com' &&
(github.event_name == 'workflow_dispatch' && inputs.publish) (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
)
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
+21 -10
View File
@@ -210,13 +210,23 @@ make -C build install INSTALL_ROOT=/tmp/pkg # 打包用,装到 /tmp/pkg/usr/lo
`.github/workflows/packages.yml` 是给 GitHub 镜像用的:推代码、打 tag、PR 或手动运行时编译, `.github/workflows/packages.yml` 是给 GitHub 镜像用的:推代码、打 tag、PR 或手动运行时编译,
并打出下面这些安装包。 并打出下面这些安装包。
> **Gitea 也会读这个目录**:Gitea Actions 兼容 GitHub,默认同时扫描 `.gitea/workflows` 和 **Gitea 也会读这个目录**:Gitea Actions 兼容 GitHub,默认同时扫描 `.gitea/workflows` 和
> `.github/workflows`,光靠 YAML 没法让 Gitea 忽略它。要它不在 Gitea 跑,三选一: `.github/workflows`。工作流里每个 job 都加了 `github.server_url == 'https://github.com'` 的守卫,
> 在 Gitea 上只会显示 skipped、不占 runner;要连 Actions 列表里的 run 都不出现,任选一个:
> - 仓库 **设置 → 高级设置** 里取消「启用 Actions」:整个仓库的 Actions 都停,GitHub 不受影响
> - 或 **Actions → 安装包 → 禁用工作流**:只停这一个(Gitea 1.22+) - 仓库 **设置 → Actions → General**,取消勾选 **Enable Actions** 后保存(整个仓库的 Actions 全停)
> - 或服务器 `app.ini` 里设 `[actions] WORKFLOW_DIRS = .gitea/workflows`:Gitea 只读 - 或 **Actions → 安装包** 页面点 **Disable Workflow**(只停这一个工作流)
> `.gitea/workflows`,`.github/workflows` 就只对 GitHub 生效(需要支持该配置的版本) - 或服务器 `app.ini` 里设 `[actions] WORKFLOW_DIRS = .gitea/workflows`,Gitea 就只读
`.gitea/workflows`,`.github/workflows` 只对 GitHub 生效
Gitea 1.27 也可以直接调 API(`TOKEN` 换成你的访问令牌,`<id>` 用列表里返回的值):
```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/<id>/disable
```
| 平台 | runner | 产物 | | 平台 | runner | 产物 |
| --- | --- | --- | | --- | --- | --- |
@@ -239,9 +249,10 @@ make -C build install INSTALL_ROOT=/tmp/pkg # 打包用,装到 /tmp/pkg/usr/lo
### 发 Release ### 发 Release
- 打 tag:`git tag v0.12.5 && git push origin v0.12.4`(同步到 GitHub 时把 tag 一起推过去) - 推 main、打 tag、手动 Run workflow 都会**自动发 Release**(PR 不发)
- 不打 tag:**Actions → 安装包 → Run workflow**,勾上 **publish**,会用 `v<版本>` 当 tag - tag 用 `v<版本>`,版本号在 `VoiletMark.pro` 的 `VERSION` 里;同一版本多次推送会更新同一个 Release 的安装包
- 普通推送 / PR 只上传 artifact,不发 Release——「发布到 Release」显示 skipped 是正常的 - 想发新版本就改 `VERSION`,下一次推送会自动建 `v<新版本>` 的 Release
- Release 是正式发布(不是草稿 / 预发布),并设为 Latest
### 本地打包(Linux) ### 本地打包(Linux)