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

+69
View File
@@ -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.