diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /.github/workflows/public-release.yml | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to '.github/workflows/public-release.yml')
| -rw-r--r-- | .github/workflows/public-release.yml | 178 |
1 files changed, 127 insertions, 51 deletions
diff --git a/.github/workflows/public-release.yml b/.github/workflows/public-release.yml index 14d4e611..f515a6fd 100644 --- a/.github/workflows/public-release.yml +++ b/.github/workflows/public-release.yml @@ -16,16 +16,54 @@ jobs: if: github.repository == 'WSJTX/wsjtx' runs-on: ubuntu-latest timeout-minutes: 10 + permissions: + actions: read + contents: read outputs: version: ${{ steps.identity.outputs.version }} release_channel: ${{ steps.identity.outputs.channel }} - rc_number: ${{ steps.identity.outputs.rc_number }} + prerelease_number: ${{ steps.identity.outputs.prerelease_number }} macos_sign_mode: ${{ steps.identity.outputs.macos_sign_mode }} windows_signing: ${{ steps.identity.outputs.windows_signing }} + image_tag: ${{ steps.linux-images.outputs.image_tag }} + x86_64_digest: ${{ steps.linux-images.outputs.x86_64_digest }} + aarch64_digest: ${{ steps.linux-images.outputs.aarch64_digest }} + armhf_digest: ${{ steps.linux-images.outputs.armhf_digest }} + armhf_cross_digest: ${{ steps.linux-images.outputs.armhf_cross_digest }} steps: - uses: actions/checkout@v7 with: fetch-depth: 0 + - name: Validate final publication environment protection + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + CHANNEL=$(python3 .github/scripts/release-policy.py classify "${GITHUB_REF_NAME#v}" | jq -r .channel) + ENVIRONMENT=public-release + POLICIES=() + if [ "$CHANNEL" = BETA ]; then + ENVIRONMENT=beta-release + if ! gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT/deployment-branch-policies" \ + > "$RUNNER_TEMP/publication-deployment-policies.json"; then + echo "::error::Unable to read $ENVIRONMENT deployment policies." + exit 1 + fi + POLICIES=(--deployment-policies "$RUNNER_TEMP/publication-deployment-policies.json") + fi + if ! gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT" \ + > "$RUNNER_TEMP/publication-environment.json"; then + echo "::error::Unable to read $ENVIRONMENT environment protection rules." + exit 1 + fi + python3 .github/scripts/release-policy.py validate-publication-environment \ + "$RUNNER_TEMP/publication-environment.json" --channel "$CHANNEL" "${POLICIES[@]}" - name: Validate public release tag and source identity id: identity env: @@ -33,36 +71,37 @@ jobs: run: | set -euo pipefail if [[ ! "$GITHUB_REF_NAME" =~ ^v(.+)$ ]]; then - echo "::error::Expected vX.Y.Z or vX.Y.Z-rcN" + echo "::error::Expected vX.Y.Z, vX.Y.Z-betaN, or vX.Y.Z-rcN" exit 1 fi VERSION="${GITHUB_REF_NAME#v}" IDENTITY=$(python3 .github/scripts/release-policy.py validate-source "$VERSION") + CHANNEL=$(jq -r .channel <<<"$IDENTITY") { echo "version=$(jq -r .version <<<"$IDENTITY")" - echo "channel=$(jq -r .channel <<<"$IDENTITY")" - echo "rc_number=$(jq -r .rc_number <<<"$IDENTITY")" + echo "channel=$CHANNEL" + echo "prerelease_number=$(jq -r .prerelease_number <<<"$IDENTITY")" echo "windows_signing=$(jq -r .windows_signing <<<"$IDENTITY")" } >> "$GITHUB_OUTPUT" - if [ "$MACOS_DISTRIBUTION_SIGNING_ENABLED" = true ]; then + if [ "$CHANNEL" = BETA ]; then + echo "macos_sign_mode=validation" >> "$GITHUB_OUTPUT" + echo "::notice::Betas publish the validated unsigned macOS packages as immutable assets." + elif [ "$MACOS_DISTRIBUTION_SIGNING_ENABLED" = true ]; then echo "macos_sign_mode=distribution" >> "$GITHUB_OUTPUT" else echo "macos_sign_mode=validation" >> "$GITHUB_OUTPUT" echo "::notice::macOS distribution signing is disabled. Validated packages will be published for manual replacement." fi - - linux-images: - needs: prepare - uses: ./.github/workflows/publish-linux-ci-images.yml - permissions: - contents: read - packages: write - with: - publication_target: public-release - mode: refresh - promote: false - image_set: normal - include_armhf: true + - name: Validate public release-line state + run: | + set -euo pipefail + python3 .github/scripts/release-policy.py \ + public-release-line "${GITHUB_REF_NAME#v}" --remote origin + - name: Validate prepared Linux images + id: linux-images + run: | + python3 .github/scripts/release-linux-images.py validate release-linux-images.json \ + --check-remote --github-output "$GITHUB_OUTPUT" macos: needs: prepare @@ -76,8 +115,6 @@ jobs: arch: arm64 runner: macos-15 deployment_target: "11.0" - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} signing_mode: ${{ needs.prepare.outputs.macos_sign_mode }} macos-intel: @@ -92,12 +129,10 @@ jobs: 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 }} signing_mode: ${{ needs.prepare.outputs.macos_sign_mode }} linux: - needs: [prepare, linux-images] + needs: prepare uses: ./.github/workflows/build-linux.yml permissions: actions: read @@ -108,14 +143,12 @@ jobs: hamlib_branch: "4.7.2" arch: x86_64 image_source: public-release - image_tag: ${{ needs.linux-images.outputs.image_tag }} - image_digest: ${{ needs.linux-images.outputs.x86_64_digest }} + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.x86_64_digest }} build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-arm: - needs: [prepare, linux-images] + needs: prepare uses: ./.github/workflows/build-linux.yml permissions: actions: read @@ -126,14 +159,12 @@ jobs: hamlib_branch: "4.7.2" arch: aarch64 image_source: public-release - image_tag: ${{ needs.linux-images.outputs.image_tag }} - image_digest: ${{ needs.linux-images.outputs.aarch64_digest }} + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.aarch64_digest }} build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-armhf: - needs: [prepare, linux-images] + needs: prepare uses: ./.github/workflows/build-linux.yml permissions: actions: read @@ -144,12 +175,10 @@ jobs: hamlib_branch: "4.7.2" arch: armhf image_source: public-release - image_tag: ${{ needs.linux-images.outputs.image_tag }} - image_digest: ${{ needs.linux-images.outputs.armhf_digest }} - armhf_cross_image_digest: ${{ needs.linux-images.outputs.armhf_cross_digest }} + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.armhf_digest }} + armhf_cross_image_digest: ${{ needs.prepare.outputs.armhf_cross_digest }} build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} windows: needs: prepare @@ -160,11 +189,11 @@ jobs: with: version: ${{ needs.prepare.outputs.version }} release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} + prerelease_number: ${{ needs.prepare.outputs.prerelease_number }} windows_signing: ${{ needs.prepare.outputs.windows_signing }} assemble: - needs: [prepare, linux-images, macos, macos-intel, linux, linux-arm, linux-armhf, windows] + needs: [prepare, macos, macos-intel, linux, linux-arm, linux-armhf, windows] runs-on: ubuntu-latest timeout-minutes: 30 permissions: @@ -178,6 +207,9 @@ jobs: - uses: actions/download-artifact@v8 with: path: artifacts + # build-linux.yml hands this tree between its ARMHF jobs; it is no asset. + - name: Drop the ARMHF build tree + run: rm -rf artifacts/armhf-build-tree - name: Build corresponding source archive env: VERSION: ${{ needs.prepare.outputs.version }} @@ -225,10 +257,10 @@ jobs: --repository "$GITHUB_REPOSITORY" \ --commit "$GITHUB_SHA" \ --run-id "$GITHUB_RUN_ID" \ - --linux-x86-64-digest "${{ needs.linux-images.outputs.x86_64_digest }}" \ - --linux-aarch64-digest "${{ needs.linux-images.outputs.aarch64_digest }}" \ - --linux-armhf-cross-digest "${{ needs.linux-images.outputs.armhf_cross_digest }}" \ - --linux-armhf-digest "${{ needs.linux-images.outputs.armhf_digest }}" \ + --linux-x86-64-digest "${{ needs.prepare.outputs.x86_64_digest }}" \ + --linux-aarch64-digest "${{ needs.prepare.outputs.aarch64_digest }}" \ + --linux-armhf-cross-digest "${{ needs.prepare.outputs.armhf_cross_digest }}" \ + --linux-armhf-digest "${{ needs.prepare.outputs.armhf_digest }}" \ --macos-mode "$MACOS_MODE" --windows-mode "$WINDOWS_MODE" - name: Assemble publication bundle env: @@ -249,7 +281,38 @@ jobs: artifacts/wsjtx-*-windows-signing-verification \ release-bundle/verification/ fi - - name: Upload publication bundle for approval + - name: Summarize verified publication bundle + env: + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + set -euo pipefail + (cd release-bundle && sha256sum --check SHA256SUMS) + diff -u \ + <(jq -r '.assets[] | "\(.sha256) \(.name)"' release-bundle/release-manifest.json | sort) \ + <(sort release-bundle/SHA256SUMS) + test "$(jq -r .repository release-bundle/release-manifest.json)" = "$GITHUB_REPOSITORY" + test "$(jq -r .tag release-bundle/release-manifest.json)" = "$GITHUB_REF_NAME" + test "$(jq -r .commit release-bundle/release-manifest.json)" = "$GITHUB_SHA" + test "$(jq -r .workflow_run release-bundle/release-manifest.json)" = "$GITHUB_RUN_ID" + { + echo "## Verified public release bundle" + echo + printf -- '- **Public tag:** %s\n' "$(jq -r .tag release-bundle/release-manifest.json)" + printf -- '- **Full source SHA:** %s\n' "$(jq -r .commit release-bundle/release-manifest.json)" + printf -- '- **Workflow run:** [#%s](%s)\n' "$GITHUB_RUN_ID" "$RUN_URL" + printf -- '- **Windows signing:** %s\n' "$(jq -r .windows_signing.mode release-bundle/release-manifest.json | sed 's/^unsigned$/source-pinned unsigned/')" + printf -- '- **macOS signing:** %s\n' "$(jq -r .macos_signing.mode release-bundle/release-manifest.json)" + echo + echo "| Release asset | SHA-256 |" + echo "| --- | --- |" + while IFS=$'\t' read -r name digest; do + printf '| %s | %s |\n' "$name" "$digest" + done < <(jq -r '.assets[] | [.name, .sha256] | @tsv' release-bundle/release-manifest.json) + while IFS= read -r name; do + printf '| %s | Intentionally absent from SHA256SUMS (manually replaceable) |\n' "$name" + done < <(jq -r '.macos_signing.replaceable_assets[]?' release-bundle/release-manifest.json) + } >> "$GITHUB_STEP_SUMMARY" + - name: Upload publication bundle uses: actions/upload-artifact@v7 with: name: release-bundle-${{ needs.prepare.outputs.version }} @@ -261,7 +324,7 @@ jobs: needs: [prepare, assemble] runs-on: ubuntu-latest timeout-minutes: 20 - environment: public-release + environment: ${{ needs.prepare.outputs.release_channel == 'BETA' && 'beta-release' || 'public-release' }} permissions: actions: read contents: write @@ -276,6 +339,7 @@ jobs: - name: Recheck bundle and immutable public tag env: VERSION: ${{ needs.prepare.outputs.version }} + CHANNEL: ${{ needs.prepare.outputs.release_channel }} MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} WINDOWS_MODE: ${{ needs.prepare.outputs.windows_signing }} run: | @@ -286,7 +350,9 @@ jobs: test "$(jq -r .commit release-bundle/release-manifest.json)" = "$GITHUB_SHA" test "$(jq -r '.assets | length' release-bundle/release-manifest.json)" -gt 0 EXPECTED_MACOS_MODE=distribution - if [ "$MACOS_MODE" = validation ]; then + if [ "$CHANNEL" = BETA ]; then + EXPECTED_MACOS_MODE=unsigned + elif [ "$MACOS_MODE" = validation ]; then EXPECTED_MACOS_MODE=manual fi test "$(jq -r .macos_signing.mode release-bundle/release-manifest.json)" = "$EXPECTED_MACOS_MODE" @@ -302,11 +368,20 @@ jobs: GH_TOKEN: ${{ github.token }} VERSION: ${{ needs.prepare.outputs.version }} CHANNEL: ${{ needs.prepare.outputs.release_channel }} - MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} run: | set -euo pipefail mapfile -t FILES < <(find release-bundle -maxdepth 1 -type f -print | sort) mapfile -t EXPECTED_NAMES < <(printf '%s\n' "${FILES[@]}" | xargs -n1 basename | sort) + mapfile -t REPLACEABLE_NAMES < <(jq -r '.macos_signing.replaceable_assets[]' release-bundle/release-manifest.json) + LINE_POLICY=$(python3 .github/scripts/release-policy.py \ + public-release-line "$VERSION" --remote origin) + GA_RELEASE_IS_LATEST=$(jq -r .ga_release_is_latest <<<"$LINE_POLICY") + LATEST=false + if [ "$CHANNEL" = GA ] && [ "$GA_RELEASE_IS_LATEST" = true ]; then + LATEST=true + fi + echo "Public GA line $(jq -r .candidate_line <<<"$LINE_POLICY"); newest GA line is $(jq -r .newest_ga_line <<<"$LINE_POLICY")." + echo "GitHub Latest designation for a newly created release: $LATEST" CREATED=false if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then RELEASE=$(gh release view "$GITHUB_REF_NAME" --json isDraft,isPrerelease,assets) @@ -315,7 +390,7 @@ jobs: exit 1 fi EXPECTED_PRERELEASE=false - if [ "$CHANNEL" = RC ]; then + if [ "$CHANNEL" != GA ]; then EXPECTED_PRERELEASE=true fi if [ "$(jq -r .isPrerelease <<<"$RELEASE")" != "$EXPECTED_PRERELEASE" ]; then @@ -335,7 +410,7 @@ jobs: MISSING=() for file in "${FILES[@]}"; do name=$(basename "$file") - if [ "$MACOS_MODE" = validation ] && [[ "$name" == wsjtx-*-macOS.pkg ]]; then + if printf '%s\n' "${REPLACEABLE_NAMES[@]}" | grep -Fxq "$name"; then if printf '%s\n' "${ACTUAL_NAMES[@]}" | grep -Fxq "$name"; then echo "Preserving manually replaceable macOS asset: $name" else @@ -365,9 +440,10 @@ jobs: echo "Existing assets satisfy the publication bundle policy." else FLAGS=() - if [ "$CHANNEL" = RC ]; then + if [ "$CHANNEL" != GA ]; then FLAGS+=(--prerelease) fi + FLAGS+=("--latest=$LATEST") gh release create "$GITHUB_REF_NAME" \ --verify-tag \ --title "WSJT-X $VERSION" \ |
