ci(gitea): split builds and retry artifact publication
This commit is contained in:
1 parent
d83f94afd5
commit
b225008476
18 files changed
+1790
-286
No files matched your search
@@ -0,0 +1,69 @@
|
||||
# Gitea Windows and Android builds
|
||||
|
||||
The Windows x64 host runner needs Flutter 3.47.5, Python, Node, Visual Studio C++,
|
||||
JDK 21 and Android SDK 36. The native cutdex_windows Release and cutdex_android
|
||||
Maven packages must be published before building this app. The SDK Git dependency
|
||||
is pinned to Gitea; the runner account needs SSH access to that private repository.
|
||||
|
||||
Set CUTDEX_GITEA_TOKEN in repository Actions Secrets with repository read and
|
||||
package read access. It authenticates private Gitea native package downloads.
|
||||
The Android APK includes ARM64 and x86_64, uses the production flavor and currently
|
||||
uses the project's debug signing configuration. Configure formal signing before
|
||||
shipping a production signed Android release. The Windows ZIP includes the whole
|
||||
Flutter Release directory and passes the PE dependency audit. Processing workers
|
||||
and optional models are separate; these four repositories contain no worker bundle.
|
||||
|
||||
PR/main CI analyzes and tests the app, builds both platforms, and uploads
|
||||
cutdex-release-packages including SHA256SUMS and a release manifest. It also saves
|
||||
cutdex-release-metadata containing only the manifest, checksums, Windows update
|
||||
index and audit report. Platform, complete and metadata artifacts retain 30 days. Protect main
|
||||
with `Gitea CI / Gitea CI passed (pull_request)`.
|
||||
|
||||
Windows compilation and packaging are separate jobs. Compilation saves the
|
||||
unpackaged Release directory as `cutdex-windows-app` for 30 days; packaging
|
||||
downloads it and runs the existing PE audit and Velopack tools. Rerunning a failed
|
||||
packaging job reuses this app without recompiling. Assembly and Release jobs
|
||||
similarly reuse their upstream artifacts. Use the failed-job rerun option: a
|
||||
whole-workflow rerun executes compilation again. A job always restarts from its
|
||||
first step. Saving the Windows app adds one artifact transfer between the jobs.
|
||||
|
||||
CI artifact uploads attempt at most three times, waiting 5 and 15 seconds between
|
||||
attempts and replacing incomplete artifacts of the same job-owned name. Release
|
||||
attachment uploads use the same bounded delays for temporary HTTP/network errors,
|
||||
and check for already saved filenames before repeating a POST. Permanent errors
|
||||
fail immediately and final attachment byte verification remains required. If the
|
||||
Windows app cannot be saved after all attempts, its build job still needs to be
|
||||
rerun. Draft creation and final publication are not automatically retried.
|
||||
|
||||
After main CI succeeds, create v<pubspec version> at that exact commit, or manually
|
||||
dispatch the Release workflow with the existing tag. Release preparation selects
|
||||
a successful main ci.yml run for the exact tagged commit and requires unexpired
|
||||
cutdex-android-build, cutdex-windows-build and cutdex-release-metadata artifacts. It creates a draft bound to both that commit and
|
||||
that CI run. Release jobs never rebuild the app or reinstall Flutter dependencies.
|
||||
|
||||
Android and Windows independently download their platform artifacts from the
|
||||
selected CI run and immediately upload them to the draft. These jobs run in
|
||||
parallel. The final job accepts only the compact metadata artifact from that same
|
||||
CI run. Complete binary archives cannot substitute for platform packages or
|
||||
metadata. Missing, expired or duplicate required artifacts block preparation
|
||||
before any draft is created. Platform uploads check attachment presence without
|
||||
reading back their bytes. Before publication, every attachment is read back once
|
||||
and verified against trusted SHA256 checksums; the full update package also
|
||||
matches its index SHA1 and size. Upload and verification batches use at most two
|
||||
requests per job. Verification reads in 1 MiB chunks. Tag, CI, draft and attachment
|
||||
ID/name bindings are rechecked before the Release is made public.
|
||||
|
||||
A failed upload leaves the draft unpublished with successful uploads retained.
|
||||
Manual dispatch with the same tag resumes the original CI run, even if another CI
|
||||
for that commit has since succeeded. Matching attachments are reused; changed or
|
||||
unrelated attachments block publication rather than being replaced. If the
|
||||
original platform or metadata artifacts have expired, release preparation fails and requires
|
||||
operator attention. Published Releases are never overwritten. The built-in
|
||||
GITEA_TOKEN handles release writes and Actions artifact reads; no separate
|
||||
release-write PAT is required. Do not commit credentials or keystores.
|
||||
|
||||
PR/main CI produces Actions artifacts without creating Releases. If a tag is pushed
|
||||
before main CI succeeds, release preparation fails without creating a draft; retry
|
||||
the Release workflow once CI has finished. This design overlaps platform uploads,
|
||||
not main CI builds with Release uploads. There is no legacy whole-archive
|
||||
promotion entry point or format fallback.
|
||||
@@ -0,0 +1,76 @@
|
||||
# CI build performance
|
||||
|
||||
The workflow runs checks first, then Android and Windows compilation concurrently.
|
||||
Windows compilation saves `cutdex-windows-app`; an independent Windows job
|
||||
downloads that app, audits it and creates Velopack packages. Packaging needs
|
||||
neither Flutter dependencies nor another Windows compilation. The Android job
|
||||
builds the APK. The final job downloads only platform packages and
|
||||
validates the complete release manifest, update feed and checksums. The public
|
||||
artifact remains `cutdex-release-packages`.
|
||||
|
||||
Build jobs explicitly use persistent runner-user Pub and Gradle caches, respecting
|
||||
existing `PUB_CACHE` and `GRADLE_USER_HOME` overrides. Gradle task output caching is
|
||||
enabled for CI. Do not clear these caches between runs. Each job must have its own
|
||||
checkout; do not share a Flutter `build/` or `.dart_tool/` directory between jobs.
|
||||
With an ephemeral runner, these user directories must be persisted separately.
|
||||
|
||||
The runner needs at least two execution slots. The local runner configuration at
|
||||
`D:/workspace/gitea-stack/runner/config.yaml` currently has `capacity: 2`. The host
|
||||
has 12 logical processors and approximately 16 GB RAM; the Android job retains its
|
||||
3 GB heap and four-worker limit to leave room for concurrent Windows compilation.
|
||||
|
||||
`prepare-package-tools.ps1` installs pinned `pefile` and `vpk` on first use under
|
||||
the runner user's `%LOCALAPPDATA%/Cutdex/ci-tools/`. Later builds reuse them after
|
||||
version checks. Python interpreter identity and tool versions isolate the cache,
|
||||
and a mutex protects installation across concurrent workflows. .NET setup remains
|
||||
in the Windows packaging job to provide SDK 10 and the runtime required by `vpk`.
|
||||
|
||||
APK and Windows package uploads use `compression-level: 0` to avoid recompressing
|
||||
already compressed artifacts. The saved Windows app uses compression level 1,
|
||||
preserves nested and hidden runtime assets, and excludes the same debug files and
|
||||
optional workers omitted by packaging. The saved app, platform packages, compact
|
||||
metadata and validated release artifact all retain 30 days.
|
||||
|
||||
Compare warm CI runs after the first cache fill. Measure checks, Android compile,
|
||||
Windows compile, packaging and artifact transfer separately. Total duration follows
|
||||
the slower platform branch, plus checks and final assembly; no fixed speedup is
|
||||
assumed. Release audits and artifact validation remain mandatory.
|
||||
|
||||
## Failure recovery
|
||||
|
||||
Use Gitea's failed-job rerun rather than rerunning the entire workflow. A job
|
||||
reruns from its first step, including downstream dependent jobs. Once the Windows
|
||||
app artifact has been saved, a Windows packaging failure can be retried without
|
||||
recompilation. Assembly failures reuse the saved Android and Windows packages;
|
||||
Release failures reuse the successful main CI. Splitting Windows adds one app
|
||||
upload/download on successful runs in exchange for this recovery point.
|
||||
|
||||
Every CI artifact upload uses the local `upload-artifact` composite, with at most
|
||||
three action attempts and 5/15-second delays. Attempts replace incomplete
|
||||
artifacts with the same name; each name belongs to one producing job. Exhausted
|
||||
retries fail the job. If the first Windows app checkpoint cannot be uploaded,
|
||||
the build job must still be rerun; it has no saved app to restore.
|
||||
|
||||
Release attachment uploads retry temporary network errors, HTTP 408/429 and
|
||||
500/502/503/504 up to three POST attempts per file, also with 5/15-second delays.
|
||||
Before retrying a POST, the uploader checks whether Gitea already saved the named
|
||||
attachment, including after the final response is lost. This avoids duplicate
|
||||
uploads after a timeout. Authorization, invalid-input and other permanent errors
|
||||
fail immediately. No draft creation or publication PATCH is automatically retried.
|
||||
Attachment-list reads have their own bounded retries. Final byte verification
|
||||
remains mandatory even when an existing filename is reused.
|
||||
|
||||
The tag/manual Release workflow reuses a successful main CI for the exact tagged
|
||||
commit; it performs no Flutter builds, dependency resolution or Windows packaging.
|
||||
A prepare job binds the draft and both platform upload jobs to one CI run. Android
|
||||
and Windows independently fetch and upload their existing packages in parallel.
|
||||
Publication requires the small cutdex-release-metadata artifact; it never
|
||||
downloads the combined binary artifact. Missing or expired metadata/platform
|
||||
artifacts fail preparation, with no old-format fallback. Every remote file is read and verified once, immediately
|
||||
before publication, with two verification workers and 1 MiB chunks. Platform
|
||||
upload steps check presence without repeating binary readbacks. Each upload
|
||||
batch also uses at most two workers; while both platform jobs run, Android can
|
||||
have one upload in flight alongside two Windows uploads.
|
||||
Retries retain the original CI-run binding. Ordinary CI never creates
|
||||
drafts. Wait for main CI success before tagging or retry Release after it finishes;
|
||||
platform Release uploads overlap each other, not the original main builds.
|
||||
@@ -1,26 +0,0 @@
|
||||
# Gitea Windows and Android builds
|
||||
|
||||
The Windows x64 host runner needs Flutter 3.47.5, Python, Node, Visual Studio C++,
|
||||
JDK 21 and Android SDK 36. The native cutdex_windows Release and cutdex_android
|
||||
Maven packages must be published before building this app. The SDK Git dependency
|
||||
is pinned to Gitea; the runner account needs SSH access to that private repository.
|
||||
|
||||
Set CUTDEX_GITEA_TOKEN in repository Actions Secrets with repository read and
|
||||
package read access. It authenticates private Gitea native package downloads.
|
||||
The Android APK includes ARM64 and x86_64, uses the production flavor and currently
|
||||
uses the project's debug signing configuration. Configure formal signing before
|
||||
shipping a production signed Android release. The Windows ZIP includes the whole
|
||||
Flutter Release directory and passes the PE dependency audit. Processing workers
|
||||
and optional models are separate; these four repositories contain no worker bundle.
|
||||
|
||||
PR/main CI analyzes and tests the app, builds both platforms, and uploads
|
||||
cutdex-release-packages including SHA256SUMS and a release manifest. Protect main
|
||||
with `Gitea CI / Gitea CI passed (pull_request)`.
|
||||
|
||||
After main CI succeeds, create v<pubspec version> at that exact commit. The Release
|
||||
workflow downloads the existing CI artifact, requires both APK and Windows ZIP,
|
||||
checks their digests, uploads to a draft Release, verifies remote bytes, then
|
||||
publishes it. It refuses to overwrite a published Release. A manual dispatch with
|
||||
the existing tag can retry an interrupted draft publication. The built-in GITEA_TOKEN
|
||||
handles release writes and Actions artifact reads; no separate release-write PAT
|
||||
is required. Do not commit credentials or keystores.
|
||||
@@ -0,0 +1,63 @@
|
||||
name: Upload CI artifact with bounded retries
|
||||
description: Save an artifact with at most three attempts, replacing incomplete uploads of the same name.
|
||||
inputs:
|
||||
name:
|
||||
description: Artifact name, unique to this job in the workflow run
|
||||
required: true
|
||||
path:
|
||||
description: Files and directories to upload
|
||||
required: true
|
||||
compression-level:
|
||||
description: ZIP compression level
|
||||
default: '0'
|
||||
retention-days:
|
||||
description: Artifact retention in days
|
||||
default: '30'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Upload artifact (attempt 1 of 3)
|
||||
id: first
|
||||
continue-on-error: true
|
||||
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
path: ${{ inputs.path }}
|
||||
compression-level: ${{ inputs.compression-level }}
|
||||
retention-days: ${{ inputs.retention-days }}
|
||||
if-no-files-found: error
|
||||
include-hidden-files: true
|
||||
overwrite: true
|
||||
- name: Wait before second upload attempt
|
||||
if: ${{ !cancelled() && steps.first.outcome == 'failure' }}
|
||||
shell: pwsh
|
||||
run: Start-Sleep -Seconds 5
|
||||
- name: Upload artifact (attempt 2 of 3)
|
||||
id: second
|
||||
if: ${{ !cancelled() && steps.first.outcome == 'failure' }}
|
||||
continue-on-error: true
|
||||
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
path: ${{ inputs.path }}
|
||||
compression-level: ${{ inputs.compression-level }}
|
||||
retention-days: ${{ inputs.retention-days }}
|
||||
if-no-files-found: error
|
||||
include-hidden-files: true
|
||||
overwrite: true
|
||||
- name: Wait before final upload attempt
|
||||
if: ${{ !cancelled() && steps.first.outcome == 'failure' && steps.second.outcome == 'failure' }}
|
||||
shell: pwsh
|
||||
run: Start-Sleep -Seconds 15
|
||||
- name: Upload artifact (attempt 3 of 3)
|
||||
id: third
|
||||
if: ${{ !cancelled() && steps.first.outcome == 'failure' && steps.second.outcome == 'failure' }}
|
||||
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
with:
|
||||
name: ${{ inputs.name }}
|
||||
path: ${{ inputs.path }}
|
||||
compression-level: ${{ inputs.compression-level }}
|
||||
retention-days: ${{ inputs.retention-days }}
|
||||
if-no-files-found: error
|
||||
include-hidden-files: true
|
||||
overwrite: true
|
||||
+151
-30
@@ -19,65 +19,185 @@ env:
|
||||
GIT_CONFIG_KEY_1: core.eol
|
||||
GIT_CONFIG_VALUE_1: lf
|
||||
jobs:
|
||||
build:
|
||||
name: Windows x64 and Android
|
||||
quality:
|
||||
name: Check code and tests
|
||||
runs-on: cutdex-windows-x64
|
||||
env:
|
||||
GITEA_ACTOR: lingjhf
|
||||
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
- name: Check out source
|
||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify toolchains
|
||||
- name: Configure persistent build caches
|
||||
run: ./tool/gitea/prepare-build-cache.ps1
|
||||
- name: Verify Flutter version and configure Java
|
||||
run: |
|
||||
$version = flutter --version --machine | ConvertFrom-Json
|
||||
if ($version.frameworkVersion -ne '3.47.5') { throw 'Flutter 3.47.5 required.' }
|
||||
flutter config --jdk-dir=$env:JAVA_HOME
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Flutter JDK setup failed.' }
|
||||
- run: flutter pub get --enforce-lockfile
|
||||
- run: dart analyze --fatal-infos
|
||||
- run: flutter test --reporter expanded test packages/cutdex_ui/test packages/cutdex_native/test
|
||||
- name: Validate update and release tooling
|
||||
- name: Resolve locked Flutter dependencies
|
||||
run: flutter pub get --enforce-lockfile
|
||||
- name: Analyze Dart code
|
||||
run: dart analyze --fatal-infos
|
||||
- name: Run Flutter tests
|
||||
run: flutter test --reporter expanded test packages/cutdex_ui/test packages/cutdex_native/test
|
||||
- name: Test update and release tools
|
||||
run: |
|
||||
python -m unittest discover -s tool/gitea -p 'test_*.py'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Release tooling tests failed.' }
|
||||
python -m unittest discover -s tool/windows -p '*_unit.py'
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Update tooling tests failed.' }
|
||||
- name: Bound Android build memory on the shared runner
|
||||
|
||||
android:
|
||||
name: Build Android APK
|
||||
needs: quality
|
||||
runs-on: cutdex-windows-x64
|
||||
env:
|
||||
GITEA_ACTOR: lingjhf
|
||||
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure persistent build caches
|
||||
run: ./tool/gitea/prepare-build-cache.ps1
|
||||
- name: Verify Flutter version and configure Java
|
||||
run: |
|
||||
$version = flutter --version --machine | ConvertFrom-Json
|
||||
if ($version.frameworkVersion -ne '3.47.5') { throw 'Flutter 3.47.5 required.' }
|
||||
flutter config --jdk-dir=$env:JAVA_HOME
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Flutter JDK setup failed.' }
|
||||
- name: Resolve locked Flutter dependencies
|
||||
run: flutter pub get --enforce-lockfile
|
||||
- name: Configure Gradle memory and build cache
|
||||
run: |
|
||||
$file = 'android/gradle.properties'
|
||||
$properties = [IO.File]::ReadAllText($file).Replace('-Xmx8G', '-Xmx3G').Replace('MaxMetaspaceSize=4G', 'MaxMetaspaceSize=768m')
|
||||
[IO.File]::WriteAllText($file, $properties + "`norg.gradle.workers.max=4`n")
|
||||
- run: flutter build apk --release --flavor production --target-platform android-arm64,android-x64
|
||||
- name: Build Windows from the pinned Gitea native release
|
||||
[IO.File]::WriteAllText($file, $properties + "`norg.gradle.workers.max=4`norg.gradle.caching=true`n")
|
||||
- name: Build production Android APK
|
||||
run: flutter build apk --no-pub --release --flavor production --target-platform android-arm64,android-x64
|
||||
- name: Upload Android CI artifact
|
||||
uses: ./.gitea/actions/upload-artifact
|
||||
with:
|
||||
name: cutdex-android-build
|
||||
path: build/app/outputs/flutter-apk/app-production-release.apk
|
||||
compression-level: 0
|
||||
retention-days: 30
|
||||
|
||||
windows-build:
|
||||
name: Build Windows x64 app
|
||||
needs: quality
|
||||
runs-on: cutdex-windows-x64
|
||||
env:
|
||||
GITEA_ACTOR: lingjhf
|
||||
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure persistent build caches
|
||||
run: ./tool/gitea/prepare-build-cache.ps1
|
||||
- name: Verify Flutter version
|
||||
run: |
|
||||
$version = flutter --version --machine | ConvertFrom-Json
|
||||
if ($version.frameworkVersion -ne '3.47.5') { throw 'Flutter 3.47.5 required.' }
|
||||
- name: Resolve locked Flutter dependencies
|
||||
run: flutter pub get --enforce-lockfile
|
||||
- name: Build production Windows app
|
||||
run: |
|
||||
Remove-Item Env:CUTDEX_WINDOWS_PATH, Env:CUTDEX_WINDOWS_PACKAGE_PATH -ErrorAction SilentlyContinue
|
||||
flutter build windows --release --flavor production
|
||||
flutter build windows --no-pub --release --flavor production
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed.' }
|
||||
- name: Prepare isolated packaging tools
|
||||
run: |
|
||||
python -m venv .build/package-tools
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Packaging environment setup failed.' }
|
||||
& ./.build/package-tools/Scripts/python.exe -m pip install pefile==2024.8.26
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Packaging dependency installation failed.' }
|
||||
- uses: https://github.com/actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
|
||||
- name: Save Windows app for independent packaging retries
|
||||
uses: ./.gitea/actions/upload-artifact
|
||||
with:
|
||||
name: cutdex-windows-app
|
||||
path: |
|
||||
build/windows/x64/production/runner/Release/
|
||||
!build/windows/x64/production/runner/Release/**/processing/**
|
||||
!build/windows/x64/production/runner/Release/**/*.pdb
|
||||
!build/windows/x64/production/runner/Release/**/*.lib
|
||||
!build/windows/x64/production/runner/Release/**/*.exp
|
||||
!build/windows/x64/production/runner/Release/**/dartjni.dll
|
||||
compression-level: 1
|
||||
retention-days: 30
|
||||
|
||||
windows:
|
||||
name: Audit and package Windows x64
|
||||
needs: windows-build
|
||||
runs-on: cutdex-windows-x64
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Download saved Windows app
|
||||
uses: https://github.com/actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
with:
|
||||
name: cutdex-windows-app
|
||||
path: build/windows/x64/production/runner/Release/
|
||||
- name: Set up .NET SDK
|
||||
uses: https://github.com/actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
- name: Install pinned Velopack release tool
|
||||
- name: Prepare pinned packaging tools
|
||||
run: ./tool/gitea/prepare-package-tools.ps1
|
||||
- name: Audit and package Windows release
|
||||
run: |
|
||||
dotnet tool install vpk --version 1.2.161 --tool-path .build/vpk
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Velopack tool installation failed.' }
|
||||
- name: Package application
|
||||
& $env:PACKAGE_PYTHON tool/gitea/package-app.py --platform windows --vpk $env:VPK_PATH
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows packaging failed.' }
|
||||
- name: Upload Windows CI artifact
|
||||
uses: ./.gitea/actions/upload-artifact
|
||||
with:
|
||||
name: cutdex-windows-build
|
||||
path: dist/*
|
||||
compression-level: 0
|
||||
retention-days: 30
|
||||
|
||||
build:
|
||||
name: Assemble and validate CI artifacts
|
||||
needs: [android, windows]
|
||||
runs-on: cutdex-windows-x64
|
||||
env:
|
||||
GITEA_ACTOR: lingjhf
|
||||
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Download Android CI artifact
|
||||
uses: https://github.com/actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
with:
|
||||
name: cutdex-android-build
|
||||
path: build/app/outputs/flutter-apk/
|
||||
- name: Download Windows CI artifact
|
||||
uses: https://github.com/actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
with:
|
||||
name: cutdex-windows-build
|
||||
path: .build/windows-packages/
|
||||
- name: Validate packages and generate metadata
|
||||
run: |
|
||||
& ./.build/package-tools/Scripts/python.exe tool/gitea/package-app.py --vpk .build/vpk/vpk.exe
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Application packaging failed.' }
|
||||
- name: Upload Android and Windows packages
|
||||
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
|
||||
python tool/gitea/package-app.py --platform assemble --windows-packages .build/windows-packages
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Application artifact validation failed.' }
|
||||
- name: Upload combined CI artifact
|
||||
uses: ./.gitea/actions/upload-artifact
|
||||
with:
|
||||
name: cutdex-release-packages
|
||||
path: dist/*
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
retention-days: 30
|
||||
- name: Upload release verification metadata
|
||||
uses: ./.gitea/actions/upload-artifact
|
||||
with:
|
||||
name: cutdex-release-metadata
|
||||
path: .build/release-metadata/*
|
||||
compression-level: 0
|
||||
retention-days: 30
|
||||
checks:
|
||||
name: Gitea CI passed
|
||||
@@ -85,7 +205,8 @@ jobs:
|
||||
needs: build
|
||||
runs-on: cutdex-windows-x64
|
||||
steps:
|
||||
- env:
|
||||
- name: Verify CI result
|
||||
env:
|
||||
RESULT: ${{ needs.build.result }}
|
||||
run: |
|
||||
if ($env:RESULT -ne 'success') { throw "App build: $env:RESULT" }
|
||||
+105
-10
@@ -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.' }
|
||||
Reference in new issue
Block a user