From 623b7a81853d00590c86ef54cea1eaa4afab0fba Mon Sep 17 00:00:00 2001 From: liyepan Date: Fri, 23 Oct 2026 14:26:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20v0.12.3=20=E2=80=94=E2=80=94=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20Release=20=E5=8F=91=E5=B8=83=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E6=89=8B=E5=8A=A8=E5=8B=BE=E9=80=89?= =?UTF-8?q?=20publish=20=E5=8F=91=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 「发布到 Release」以前只有在推 v* tag 时才跑,普通推送/PR 会显示 skipped, 容易以为坏了;现在条件写成 always() && (tag || 手动 publish) - workflow_dispatch 增加 publish 布尔输入:不打 tag 也能发版,用 v<版本> 作为 tag(不存在就按当前提交新建),省得同步工具漏推 tag - Release 任务里补上 checkout 和版本号读取,Release 标题用 VoiletMark <版本> - 用 always() 代替 !cancelled(),ARM runner 缺失导致 package 失败时也能收尾; 仍然会先检查 x86_64 的包在不在,缺了就不发 - README 写清楚两种发版方式和「skipped 是正常的」这一条 --- .github/workflows/linux-packages.yml | 34 ++++++++++++++++++++++++---- README.md | 15 ++++++------ VoiletMark.pro | 2 +- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.github/workflows/linux-packages.yml b/.github/workflows/linux-packages.yml index 2bdde1c..24952bc 100644 --- a/.github/workflows/linux-packages.yml +++ b/.github/workflows/linux-packages.yml @@ -8,6 +8,11 @@ on: tags: ["v*"] pull_request: workflow_dispatch: + inputs: + publish: + description: "发布 Release(用 v<版本> 当 tag,不必先打 tag)" + type: boolean + default: false permissions: contents: write @@ -101,12 +106,29 @@ jobs: release: name: 发布到 Release needs: package - # ARM 那个 job 可能因为拿不到 arm runner 而失败,这里用 !cancelled() 照常收尾; - # 下面单独检查 x86_64 的包在不在,缺了就不发 Release。 - if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/') }} + # 只有两种情况发 Release: + # 1. 推了 v* tag + # 2. 手动 Run workflow 并勾上 publish + # 普通推送(main / PR)只会留下 artifact,这一步显示 skipped 是正常的。 + # 用 always() 是为了 ARM 那个 job 失败(拿不到 arm runner)时这里照常收尾, + # 下面会检查 x86_64 的包在不在,缺了就不发。 + if: >- + always() && ( + startsWith(github.ref, 'refs/tags/') || + (github.event_name == 'workflow_dispatch' && inputs.publish) + ) runs-on: ubuntu-24.04 timeout-minutes: 10 steps: + - name: 检出代码 + uses: actions/checkout@v4 + + - name: 读取版本号 + id: meta + run: | + version=$(sed -n 's/^VERSION[[:space:]]*=[[:space:]]*//p' VoiletMark.pro | head -n1 | tr -d '[:space:]') + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: 下载所有产物 uses: actions/download-artifact@v4 with: @@ -127,9 +149,13 @@ jobs: sha256sum ./*.deb ./*.rpm > SHA256SUMS cat SHA256SUMS - - name: 挂到对应 tag 的 Release + - name: 挂到 Release uses: softprops/action-gh-release@v2 with: + # 打 tag 时用那个 tag;手动发布时用 v<版本>(不存在就按当前提交新建) + tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', steps.meta.outputs.version) }} + target_commitish: ${{ github.sha }} + name: VoiletMark ${{ steps.meta.outputs.version }} files: dist/* generate_release_notes: true fail_on_unmatched_files: true diff --git a/README.md b/README.md index 3454eac..07edbe8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 一个轻量的跨平台 Markdown 编辑器,基于 **Qt 5 / C++17** 构建。 -当前版本 **0.12.2**。 +当前版本 **0.12.3**。 ## 界面 @@ -215,7 +215,12 @@ make -C build install INSTALL_ROOT=/tmp/pkg # 打包用,装到 /tmp/pkg/usr/lo - aarch64(`ubuntu-24.04-arm`):`..._arm64.deb` 和 `...aarch64.rpm`。这个 runner 公共仓库才有; 私有仓库里 ARM 那一步设成了 `continue-on-error`,失败不会影响 x86_64 的包, 也可以把 `runs-on` 换成自建的 arm64 runner -- 每次构建都会上传 artifact;打 tag 时自动把安装包和 `SHA256SUMS` 挂到对应的 Release +- 每次构建都会上传 artifact +- 发 Release 的两种方式: + - 打 tag:`git tag v0.12.3 && git push origin v0.12.3`(同步到 GitHub 时把 tag 一起推过去) + - 不打 tag:**Actions → Linux 安装包 → Run workflow**,把 **publish** 勾上, + 它会用 `v<版本>` 当 tag(不存在就按当前提交新建)并发出 Release +- 普通推送到 main / PR 只上传 artifact,不发 Release——「发布到 Release」显示 skipped 是正常的 本地打包(版本号从 `VoiletMark.pro` 里取): @@ -236,12 +241,6 @@ sudo apt install ./voiletmark_*_amd64.deb sudo dnf install ./voiletmark-*.x86_64.rpm ``` -要出 Release 就打个 tag(同步到 GitHub 时记得把 tag 一起推过去): - -```bash -git tag v0.12.2 && git push origin v0.12.2 -``` - 打 rpm 需要 `rpmbuild`(Ubuntu 上 `apt install rpm`)。rpm 的 `License` 字段现在写的是 `Proprietary`(仓库里还没放 LICENSE 文件),要换许可证改 `packaging/build-rpm.sh` 里那一行即可。 diff --git a/VoiletMark.pro b/VoiletMark.pro index e640370..50f1b58 100644 --- a/VoiletMark.pro +++ b/VoiletMark.pro @@ -1,6 +1,6 @@ TEMPLATE = app TARGET = VoiletMark -VERSION = 0.12.2 +VERSION = 0.12.3 QT += core gui widgets