From 4f817f6d86c0bbad3447847d81a7ef59541eb8f6 Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Tue, 10 Nov 2026 19:26:36 +0100 Subject: [PATCH] =?UTF-8?q?CI=20=E5=92=8C=E5=8F=91=E7=89=88=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E8=AE=A4=20release/*=20=E5=8F=91=E7=89=88=E5=88=86?= =?UTF-8?q?=E6=94=AF=EF=BC=8CWindows=20=E5=BA=93=E5=AD=98=E6=88=90?= =?UTF-8?q?=E4=BA=A7=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ci.yml 的 push 触发加上 release/**,Windows 构建存 windows-libs 产物;release.yml 的 tag 祖先检查也认 origin/release/* 分支。 Refs ModAVD/ModAVD#175 --- .github/workflows/ci.yml | 10 +++++++++- .github/workflows/release.yml | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9187244..94cc4a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: pull_request: push: - branches: [main] + branches: [main, "release/**"] merge_group: workflow_dispatch: @@ -31,6 +31,14 @@ jobs: if ($LASTEXITCODE -ne 0) { throw "tests failed" } # In the format of release/.SHA256SUMS.txt. Get-ChildItem build\Release\*.dll | Sort-Object Name | ForEach-Object { '{0} {1}' -f (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant(), $_.Name } + - name: Upload the Windows libraries + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: windows-libs + path: | + build/Release/modavd_extras.dll + build/Release/external_renderer_ipc.dll + if-no-files-found: error posix: strategy: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ec855e..033a3fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,9 +29,17 @@ jobs: SHA: ${{ github.sha }} run: | if ($env:TAG -cnotmatch '^v[0-9]+\.[0-9]+\.[0-9]+$') { throw "invalid tag: $env:TAG" } - # Full ref name: a tag called origin/main would win over the remote branch. + # Full ref names: a tag called origin/main would win over the remote branch. + # On main, or on any release/* branch. git merge-base --is-ancestor $env:SHA refs/remotes/origin/main - if ($LASTEXITCODE -ne 0) { throw 'tag is not on origin/main' } + $onBranch = ($LASTEXITCODE -eq 0) + if (-not $onBranch) { + foreach ($ref in @(git for-each-ref --format='%(refname)' refs/remotes/origin/release/)) { + git merge-base --is-ancestor $env:SHA $ref + if ($LASTEXITCODE -eq 0) { $onBranch = $true; break } + } + } + if (-not $onBranch) { throw 'tag is not on origin/main or any origin/release/* branch' } $version = $env:TAG.Substring(1) $found = @(Select-String -LiteralPath CMakeLists.txt -CaseSensitive -Pattern '^project\(ModAVDExtras VERSION ([0-9]+\.[0-9]+\.[0-9]+)') if ($found.Count -ne 1) { throw "expected one project(ModAVDExtras VERSION ...) line in CMakeLists.txt, found $($found.Count)" }