Patch validation runs on each patchset push, on manual dispatch, and as a
reusable workflow called by Sync upstream. Push and manual validation are
read-only.
Sync upstream is the only release-capable entry point. It runs on an hourly
schedule or manual dispatch. The complete graph uses the
sub2api-release-mutation concurrency group with cancel-in-progress: false.
Each run fetches Wei-Shaw/sub2api/main through the fixed HTTPS read-only
remote. scripts/upstream-ci-ready.sh walks its first-parent history and selects
the newest commit whose own completed check runs named test, frontend, and
golangci-lint all concluded with success. API or Git query failures stop the
run. No configured SHA limits the search to a historical release base.
The reusable validation workflow checks out the selected patchset, fetches the selected upstream commit, and runs these checks:
- Workflow wiring smoke tests and interrupted-release recovery scenarios.
- Upstream selection, version computation, refresh, and sanitizer script tests.
- Patch replay from the dynamically selected upstream commit, without a fixed historical tree or byte-for-byte regenerated patch requirement.
- Patch and release-text reference sanitization.
- Upstream backend
make test-unitandmake test-integration, including tagged tests and Docker testcontainers. - Backend lint and format checks.
- Frontend frozen-lockfile install and upstream
make test-frontend, including typecheck, lint, and critical Vitest tests. - A Docker Buildx build with
push: falseandload: false.
The release job is a static dependency of successful resolution and validation. Validation failures cannot reach publication.
The single release job reconstructs the mirror and patched commits from the
resolved inputs. It computes the next v<upstream-version>-patch.N version by
querying both tag and GitHub Release namespaces. Failed remote queries stop the
job. Before comparing trees, the job checks the version tag at the published
patched tip for its image and GitHub Release. If either is missing, it checks
out that existing tag and publishes only the missing outputs. Existing version
tags, images, and releases are preserved. Recovery also restores latest-patch
from the versioned image when that image already exists. The summary identifies
the recovered version and reports that newly selected content will be evaluated
on the next sync.
If that publication is complete and the reconstructed mirror and patched trees
equal main, mirror/upstream-main, and patched, the job exits before
computing or publishing a new version. Missing or drifted mirror branches do
not qualify for this no-op.
Before mutation, the job requires all of the following to be absent:
- the computed Git tag;
- the GitHub Release for that tag; and
- the versioned
ghcr.io/<owner>/sub2api-patchimage tag.
Unexpected HTTP or registry errors are failures, not evidence of absence.
The main, mirror/upstream-main, and patched updates plus the new version
tag are one atomic Git push. Each branch update uses the tip observed during
resolution as its --force-with-lease expected value. A changed downstream
branch rejects the whole push. The new tag refspec is not forced.
After the Git push, Docker Buildx publishes the immutable version tag and the
mutable latest-patch tag. The workflow then creates the GitHub Release. A
failed publication remains visible as a failed workflow and the next run can
resume it from the reserved Git tag. No prior-run build artifacts are required.
Release notes identify the upstream VERSION file value separately from the
upstream source commit; the version value does not imply an upstream Git tag.
Workflows default to permissions: {}. Resolution and validation receive only
read permissions. The release job receives downstream contents: write and
packages: write because it updates this repository, publishes its image, and
creates its release.
No workflow pushes to upstream or sends mutating GitHub API requests to the upstream repository.