diff options
Diffstat (limited to '.github/workflows/release.yml')
| -rw-r--r-- | .github/workflows/release.yml | 428 |
1 files changed, 130 insertions, 298 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8b9bd42..bde30629 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,359 +1,191 @@ -name: Release +name: Build Release Candidate on: - push: - tags: ["build/v*"] + workflow_call: + inputs: + candidate_tag: + description: "Immutable internal tag (build/vX.Y.Z or build/vX.Y.Z-rcN)" + required: true + type: string + expected_sha: + description: "Full commit SHA selected by the release tag helper" + required: true + type: string + +permissions: + contents: read + packages: read + +concurrency: + group: release-candidate-${{ inputs.candidate_tag }} + cancel-in-progress: false jobs: - # ── Derive the version string once from the pushed tag ──────────── - # Strips the "build/v" prefix so artifacts are named "wsjtx-3.0.1-rc1-*" - # rather than "wsjtx-build/v3.0.1-rc1-*". RC/beta suffixes (e.g. - # build/v3.0.1-rc1 → 3.0.1-rc1) are preserved so pre-release artifacts - # are distinguishable from GA. All downstream jobs consume this - # single output so the five platform artifacts cannot disagree. prepare: runs-on: ubuntu-latest + timeout-minutes: 10 outputs: - version: ${{ steps.v.outputs.version }} - release_channel: ${{ steps.v.outputs.release_channel }} - rc_number: ${{ steps.v.outputs.rc_number }} + version: ${{ steps.identity.outputs.version }} + release_channel: ${{ steps.identity.outputs.channel }} + rc_number: ${{ steps.identity.outputs.rc_number }} + windows_signing: ${{ steps.identity.outputs.windows_signing }} + linux_image_tag: ${{ steps.linux-image.outputs.image_tag }} + armhf_image_tag: ${{ steps.armhf-image.outputs.image_tag }} + env: + CANDIDATE_TAG: ${{ inputs.candidate_tag }} + EXPECTED_SHA: ${{ inputs.expected_sha }} steps: - - uses: actions/checkout@v6 - - id: v + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + ref: ${{ env.CANDIDATE_TAG }} + - name: Verify immutable candidate identity + id: identity run: | - VERSION="${GITHUB_REF_NAME#build/v}" - if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - RELEASE_CHANNEL=GA - RC_NUMBER="" - elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc([1-9][0-9]*)$ ]]; then - RELEASE_CHANNEL=RC - RC_NUMBER="${BASH_REMATCH[1]}" - else - echo "::error::Unsupported release tag version: $VERSION" - echo "::error::Supported release tags are build/vX.Y.Z and build/vX.Y.Z-rcN." + set -euo pipefail + if [[ ! "$CANDIDATE_TAG" =~ ^build/v(.+)$ ]]; then + echo "::error::Expected build/vX.Y.Z or build/vX.Y.Z-rcN, got $CANDIDATE_TAG" exit 1 fi - - { - echo "version=$VERSION" - echo "release_channel=$RELEASE_CHANNEL" - echo "rc_number=$RC_NUMBER" - } >> "$GITHUB_OUTPUT" - - # Enforce that the pushed tag's numeric version base - # matches CMakeLists.txt:55 VERSION (first 3 components). CMake's - # VERSION field is numeric-only and cannot carry pre-release - # suffixes like -rc1 or -beta1, so this check compares the tag - # version stripped of any `-<suffix>` against the first three - # dotted components of CMakeLists.txt VERSION. Mismatch means the - # release commit forgot to bump CMakeLists.txt in lockstep with - # the tag; fail fast here before five platform builds burn ~30 - # minutes of CI. - - name: Verify tag ↔ CMakeLists.txt version parity - run: | - TAG_VERSION="${GITHUB_REF_NAME#build/v}" - TAG_NUMERIC="${TAG_VERSION%%-*}" - CMAKE_VERSION=$(sed -nE 's/^[[:space:]]*VERSION[[:space:]]+([0-9][0-9.]*).*/\1/p' CMakeLists.txt | head -1) - CMAKE_NUMERIC=$(echo "$CMAKE_VERSION" | awk -F. '{printf "%s.%s.%s", $1, $2, $3}') - echo "Tag version: $TAG_VERSION (numeric base: $TAG_NUMERIC)" - echo "CMakeLists.txt VER: $CMAKE_VERSION (first 3 components: $CMAKE_NUMERIC)" - if [ "$TAG_NUMERIC" != "$CMAKE_NUMERIC" ]; then - echo "::error::Tag numeric base ($TAG_NUMERIC) != CMakeLists.txt VERSION first 3 components ($CMAKE_NUMERIC)." - echo "::error::Bump CMakeLists.txt:55 VERSION in the same commit that gets tagged, then retry." + ACTUAL_SHA=$(git rev-parse HEAD) + if [ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]; then + echo "::error::Candidate tag resolves to $ACTUAL_SHA, expected $EXPECTED_SHA" exit 1 fi - echo "Parity check PASSED." - - # ── Build all five platforms ─────────────────────────────────────── - macos-arm64-qt: - needs: prepare - uses: ./.github/workflows/prepare-macos-qt.yml - with: - arch: "arm64" - runner: "macos-15" - deployment_target: "11.0" - - macos-intel-qt: - needs: prepare - uses: ./.github/workflows/prepare-macos-qt.yml - with: - arch: "x86_64" - runner: "macos-15-intel" - deployment_target: "10.13" + VERSION="${CANDIDATE_TAG#build/v}" + IDENTITY=$(python3 .github/scripts/release-policy.py validate-source "$VERSION") + { + echo "version=$(jq -r .version <<<"$IDENTITY")" + echo "channel=$(jq -r .channel <<<"$IDENTITY")" + echo "rc_number=$(jq -r .rc_number <<<"$IDENTITY")" + echo "windows_signing=$(jq -r .windows_signing <<<"$IDENTITY")" + } >> "$GITHUB_OUTPUT" + - id: linux-image + name: Resolve Linux CI image generation + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: .github/scripts/resolve-linux-ci-image-tag.py + - id: armhf-image + name: Resolve armhf CI image generation + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RESOLVE_ARMHF: true + run: .github/scripts/resolve-linux-ci-image-tag.py macos: - needs: [prepare, macos-arm64-qt] + needs: prepare uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "arm64" - runner: "macos-15" + hamlib_branch: "4.7.2" + arch: arm64 + runner: macos-15 deployment_target: "11.0" release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit + signing_mode: validation macos-intel: - needs: [prepare, macos-intel-qt] + needs: prepare uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "x86_64" + hamlib_branch: "4.7.2" + arch: x86_64 + runner: macos-15-intel + deployment_target: "10.13" release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - runner: "macos-15-intel" - deployment_target: "10.13" - secrets: inherit + signing_mode: validation linux: needs: prepare uses: ./.github/workflows/build-linux.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "x86_64" + hamlib_branch: "4.7.2" + arch: x86_64 + image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + save_ccache: true + build_packages: true release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit linux-arm: needs: prepare uses: ./.github/workflows/build-linux.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "aarch64" + hamlib_branch: "4.7.2" + arch: aarch64 + image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + save_ccache: true + build_packages: true + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} + + # Cross-compile on x86_64, then run target tests, packaging, and AppImage + # validation in the paired ARMv7 runtime image under QEMU. + linux-armhf: + needs: prepare + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: armhf + image_tag: ${{ needs.prepare.outputs.armhf_image_tag }} + allow_stale_image: true + save_ccache: true + build_packages: true release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit windows: needs: prepare uses: ./.github/workflows/build-windows.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" + hamlib_branch: "4.7.2" release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit - # ── Publish release + sync to public repo ────────────────────────── - release: - needs: [prepare, macos, macos-intel, linux, linux-arm, windows] + candidate-ready: + needs: [prepare, macos, macos-intel, linux, linux-arm, linux-armhf, windows] runs-on: ubuntu-latest - permissions: - contents: write + timeout-minutes: 15 steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Download all artifacts - uses: actions/download-artifact@v8 + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 with: path: artifacts - - # Source tarball is published on GA releases only, not on RC (-rc*, - # -beta*, etc.) pre-releases. Rationale: RCs may carry code for features - # that are not yet intended for open source distribution (limited-access - # field testing). GA releases always include a source tarball per the - # CI/CD adoption decision on platform-matrix assets. - - name: Build source tarball (GA only) - if: ${{ !contains(github.ref_name, '-') }} - env: - VERSION: ${{ needs.prepare.outputs.version }} - run: | - # This repo has no git submodules, so git archive's default - # single-tree output captures the full source. If submodules - # are ever added, this step must be revisited — git archive - # does not recurse into submodules on its own. - git archive \ - --format=tar.gz \ - --prefix="wsjtx-${VERSION}/" \ - -o "artifacts/wsjtx-${VERSION}-src.tar.gz" \ - "${GITHUB_REF_NAME}" - ls -lh "artifacts/wsjtx-${VERSION}-src.tar.gz" - - - name: List artifacts - run: find artifacts -type f | sort - - # ── All-platforms-ready gate ─────────────────────────────────────── - # Refuse to publish unless every platform produced an installer-grade - # artifact. The release job's `needs:` already enforces structural - # success (all 5 builds ran and exited 0), but a build can exit 0 - # without actually packaging — e.g. a packaging step behind an `if:` - # that evaluated false, or an upload-artifact step that silently - # matched zero files. This gate fails the release job BEFORE any - # asset upload so partial releases never reach GitHub Releases or - # the public mirror. - # - # Expected artifact layout (one installer per platform, per the - # five build-*.yml upload-artifact steps): - # artifacts/wsjtx-<ver>-arm64-macOS.pkg/*.pkg - # artifacts/wsjtx-<ver>-x86_64-macOS.pkg/*.pkg - # artifacts/wsjtx-<ver>-linux-x86_64-AppImage/*.AppImage - # artifacts/wsjtx-<ver>-linux-aarch64-AppImage/*.AppImage - # artifacts/wsjtx-<ver>-windows-x86_64-installer/*.exe - # - # Policy: publish only when all five platforms have produced an - # installer-grade artifact. Adjust or remove this step if the - # policy evolves (e.g. to publish any-platform-ready). - - name: Verify installer-grade artifacts (all-platforms-ready gate) - env: - VERSION: ${{ needs.prepare.outputs.version }} - run: | - shopt -s nullglob - labels=( - "macOS arm64 .pkg" - "macOS x86_64 .pkg" - "Linux x86_64 .AppImage" - "Linux aarch64 .AppImage" - "Windows x86_64 .exe" - ) - patterns=( - "artifacts/wsjtx-${VERSION}-arm64-macOS.pkg/*.pkg" - "artifacts/wsjtx-${VERSION}-x86_64-macOS.pkg/*.pkg" - "artifacts/wsjtx-${VERSION}-linux-x86_64-AppImage/*.AppImage" - "artifacts/wsjtx-${VERSION}-linux-aarch64-AppImage/*.AppImage" - "artifacts/wsjtx-${VERSION}-windows-x86_64-installer/*.exe" - ) - missing=0 - echo "Installer-grade artifact gate — checking 5 platforms…" - for i in "${!labels[@]}"; do - # shellcheck disable=SC2206 # word-split is intentional; nullglob makes it safe. - matches=( ${patterns[$i]} ) - if [ ${#matches[@]} -eq 0 ]; then - echo "::error::MISSING ${labels[$i]} — no match for ${patterns[$i]}" - missing=$((missing + 1)) - else - size=$(stat --printf '%s' "${matches[0]}") - printf ' ok %-22s %s (%s bytes)\n' "${labels[$i]}" "${matches[0]}" "$size" - fi - done - if [ "$missing" -gt 0 ]; then - echo "::error::All-platforms-ready gate FAILED — $missing of 5 platform(s) missing installer-grade artifact." - echo "::error::Refusing to publish a partial release. Fix the failing build job(s) and retry the tag." - exit 1 - fi - echo "All-platforms-ready gate PASSED — all 5 installer-grade artifacts present. Proceeding to publish." - - - name: Create GitHub Release - env: - GH_TOKEN: ${{ github.token }} - run: | - TAG="${GITHUB_REF_NAME}" - # Filter to user-facing release assets. `find artifacts -type f` - # without filtering pulls in 5× ctest-results.xml (one per - # platform) and per-binary tarballs from individual-binaries-* - # that collide on basename across architectures — `gh release - # create` uses basenames as asset names and duplicates cause - # upload failures. - mapfile -t files < <(find artifacts -maxdepth 2 -type f \ - \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ - -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) - # SemVer pre-release tags contain a hyphen after the version - # (e.g., v3.0.1-rc1, v3.0.1-rc2, v3.0.1-beta1). Flag those as - # GitHub pre-releases so they don't appear as the latest stable. - PRERELEASE_FLAG="" - if [[ "$TAG" == *-* ]]; then - PRERELEASE_FLAG="--prerelease" - fi - gh release create "$TAG" \ - --title "WSJT-X ${{ needs.prepare.outputs.version }}" \ - --generate-notes \ - $PRERELEASE_FLAG \ - "${files[@]}" - - # ── Public mirror: GA only ───────────────────────────────────────── - # RC/beta tags (any tag carrying a '-' in the version, e.g. - # build/v3.0.1-rc1) stay internal — the public WSJTX/wsjtx repo is - # for stable releases only. The Build source tarball step above - # uses the same predicate; mirror logic must too. - - # Defense-in-depth: the workflow trigger already constrains - # github.ref_name to tags matching build/v*, but if this job - # ever runs outside that trigger (workflow_dispatch, manual - # re-run with a fork ref, misconfiguration) the force-push - # below would overwrite WSJTX/wsjtx:master with arbitrary content. - # Abort here if the ref doesn't match the expected release-tag - # shape. - - name: Verify release tag format (GA only) - if: ${{ !contains(github.ref_name, '-') }} - run: | - if [[ "$GITHUB_REF_TYPE" != "tag" || "$GITHUB_REF_NAME" != build/v* ]]; then - echo "::error::Refusing to sync — expected tag build/v*, got $GITHUB_REF_TYPE:$GITHUB_REF_NAME" - exit 1 - fi - - - name: Push to public repo (GA only) - if: ${{ !contains(github.ref_name, '-') }} - env: - TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} + - name: Verify all candidate artifacts + run: python3 .github/scripts/release-policy.py verify-assets "${{ needs.prepare.outputs.version }}" artifacts + - name: Verify candidate packaging reports run: | - # A "successful" release that silently skips the mirror sync is - # the worst failure mode — it looks green in Actions but leaves - # users unable to download. Fail loud instead. - if [ -z "$TOKEN" ]; then - echo "::error::CROSS_REPO_TOKEN not set — refusing to publish without public-mirror sync" - exit 1 - fi - # Use CROSS_REPO_TOKEN (PAT with Contents:write on WSJTX/wsjtx) - # over HTTPS. Idempotent: on job re-run the remote already exists, - # so skip add. - if ! git remote get-url public >/dev/null 2>&1; then - git remote add public "https://x-access-token:${TOKEN}@github.com/WSJTX/wsjtx.git" - fi - - # Strip "build/" prefix per public release convention. Public - # users search for "v3.0.1", not "build/v3.0.1". Internal tag - # stays as-is for the wsjtx-internal release. - PUBLIC_TAG="${GITHUB_REF_NAME#build/}" - - # Derive the bare-prefix tag locally so the workflow doesn't - # depend on the team having pushed both tag forms. -f overwrites - # any pre-existing local tag at a stale SHA. - git tag -f "$PUBLIC_TAG" "$GITHUB_REF_NAME" - - # Human-auditable record of what the force-push is overwriting. - # If public master doesn't exist yet, ls-remote returns empty — - # still safe, just logs "no prior SHA". - PRIOR_SHA=$(git ls-remote public master | awk '{print $1}') - LOCAL_SHA=$(git rev-parse HEAD) - echo "Public mirror force-push audit:" - echo " internal tag: $GITHUB_REF_NAME" - echo " public tag: $PUBLIC_TAG" - echo " prior SHA: ${PRIOR_SHA:-<none>}" - echo " new SHA: $LOCAL_SHA" - - # --force retained per CI/CD adoption decision #3 (option a): - # automate the existing sync pattern. The v3.0.0 tag SHAs already - # match on both repos, so the force-push aligns history rather - # than rewrites it in the normal release case. - git push public HEAD:master --force - git push public "refs/tags/${PUBLIC_TAG}:refs/tags/${PUBLIC_TAG}" - - # Create the public-side GitHub Release with installer assets - # attached. Without this step, public-side Releases page is empty - # after a mirror push (source + tag, no downloadables) and end users - # can't find the artifacts. - - name: Create public GitHub Release (GA only) - if: ${{ !contains(github.ref_name, '-') }} + python3 .github/scripts/release-policy.py verify-signing-reports \ + "${{ needs.prepare.outputs.version }}" artifacts \ + --commit "${{ inputs.expected_sha }}" --tag "${{ inputs.candidate_tag }}" \ + --macos-mode validation --windows-mode unsigned + - name: Record candidate provenance env: - GH_TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} VERSION: ${{ needs.prepare.outputs.version }} + CANDIDATE_TAG: ${{ inputs.candidate_tag }} + CANDIDATE_SHA: ${{ inputs.expected_sha }} + WINDOWS_RELEASE_MODE: ${{ needs.prepare.outputs.windows_signing }} run: | - PUBLIC_TAG="${GITHUB_REF_NAME#build/}" - # Same asset filter as the internal release. Re-find rather than - # carrying a list — keeps the all-platforms-ready gate, internal - # release, and public release mechanically aligned on one filter. - mapfile -t files < <(find artifacts -maxdepth 2 -type f \ - \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ - -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) - gh release create "$PUBLIC_TAG" \ - -R WSJTX/wsjtx \ - --title "WSJT-X ${VERSION}" \ - --generate-notes \ - "${files[@]}" + jq -n \ + --arg version "$VERSION" \ + --arg tag "$CANDIDATE_TAG" \ + --arg commit "$CANDIDATE_SHA" \ + --arg repository "$GITHUB_REPOSITORY" \ + --arg run_id "$GITHUB_RUN_ID" \ + --arg windows_release_mode "$WINDOWS_RELEASE_MODE" \ + '{schema: 1, version: $version, tag: $tag, commit: $commit, repository: $repository, workflow_run: $run_id, windows_release_signing: $windows_release_mode, candidate_signing: {windows: "unsigned", macos: "validation"}}' \ + > artifacts/candidate-provenance.json + - name: Upload complete candidate + uses: actions/upload-artifact@v7 + with: + name: release-candidate-${{ needs.prepare.outputs.version }} + path: artifacts + if-no-files-found: error + retention-days: 30 |
