ci(gitea): split builds and retry artifact publication

This commit is contained in:
lingjhf committed 2026-10-06 14:04:09 +08:00
1 parent d83f94afd5
commit b225008476
18 files changed
+1790 -286

No files matched your search

+105 -10
View File
@@ -13,21 +13,116 @@ permissions:
concurrency:
group: cutdex-release
cancel-in-progress: false
defaults:
run:
shell: pwsh
env:
PYTHONUTF8: '1'
GIT_CONFIG_COUNT: '2'
GIT_CONFIG_KEY_0: core.autocrlf
GIT_CONFIG_VALUE_0: 'false'
GIT_CONFIG_KEY_1: core.eol
GIT_CONFIG_VALUE_1: lf
RELEASE_TAG: ${{ gitea.event.inputs.tag || gitea.ref_name }}
GITEA_REPOSITORY: ${{ gitea.repository }}
jobs:
release:
prepare:
name: Prepare draft Release
runs-on: cutdex-windows-x64
outputs:
sha: ${{ steps.draft.outputs.sha }}
release-id: ${{ steps.draft.outputs.release-id }}
ci-run-id: ${{ steps.draft.outputs.ci-run-id }}
artifact-id: ${{ steps.draft.outputs.artifact-id }}
android-artifact-id: ${{ steps.draft.outputs.android-artifact-id }}
windows-artifact-id: ${{ steps.draft.outputs.windows-artifact-id }}
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
steps:
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Check out release tag
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ gitea.event.inputs.tag || gitea.ref_name }}
persist-credentials: false
- name: Publish validated Android and Windows packages
shell: pwsh
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_REPOSITORY: ${{ gitea.repository }}
RELEASE_TAG: ${{ gitea.event.inputs.tag || gitea.ref_name }}
- name: Select successful CI and prepare draft
id: draft
run: |
$env:GITEA_SHA = git rev-parse HEAD
python tool/gitea/promote-release.py
if ($LASTEXITCODE -ne 0) { throw 'Release promotion failed.' }
if ($LASTEXITCODE -ne 0) { throw 'Release source resolution failed.' }
python tool/gitea/stage-release.py prepare-ci
if ($LASTEXITCODE -ne 0) { throw 'CI selection or draft preparation failed.' }
android:
name: Upload Android to draft Release
needs: prepare
runs-on: cutdex-windows-x64
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_SHA: ${{ needs.prepare.outputs.sha }}
RELEASE_ID: ${{ needs.prepare.outputs.release-id }}
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.android-artifact-id }}
steps:
- name: Check out release commit
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ needs.prepare.outputs.sha }}
persist-credentials: false
- name: Download Android CI artifact
run: |
python tool/gitea/stage-release.py fetch-android --path .build/android
if ($LASTEXITCODE -ne 0) { throw 'android CI artifact download failed.' }
- name: Upload Android packages to draft
run: |
python tool/gitea/stage-release.py android --path .build/android
if ($LASTEXITCODE -ne 0) { throw 'android draft upload failed.' }
windows:
name: Upload Windows to draft Release
needs: prepare
runs-on: cutdex-windows-x64
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_SHA: ${{ needs.prepare.outputs.sha }}
RELEASE_ID: ${{ needs.prepare.outputs.release-id }}
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.windows-artifact-id }}
steps:
- name: Check out release commit
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ needs.prepare.outputs.sha }}
persist-credentials: false
- name: Download Windows CI artifact
run: |
python tool/gitea/stage-release.py fetch-windows --path .build/windows
if ($LASTEXITCODE -ne 0) { throw 'windows CI artifact download failed.' }
- name: Upload Windows packages to draft
run: |
python tool/gitea/stage-release.py windows --path .build/windows
if ($LASTEXITCODE -ne 0) { throw 'windows draft upload failed.' }
publish:
name: Verify and publish Release
needs: [prepare, android, windows]
runs-on: cutdex-windows-x64
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_SHA: ${{ needs.prepare.outputs.sha }}
RELEASE_ID: ${{ needs.prepare.outputs.release-id }}
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.artifact-id }}
steps:
- name: Check out release commit
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ needs.prepare.outputs.sha }}
persist-credentials: false
- name: Download release verification metadata
run: |
python tool/gitea/stage-release.py fetch-release --path dist
if ($LASTEXITCODE -ne 0) { throw 'CI verification metadata validation failed.' }
- name: Verify attachments and publish Release
run: |
python tool/gitea/stage-release.py publish --path dist
if ($LASTEXITCODE -ne 0) { throw 'Release publication failed.' }