|
| 1 | +name: Promote exact candidate to Stable |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + candidate_workflow_run_id: |
| 7 | + description: Exact successful Candidate dress rehearsal workflow run ID |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + candidate_artifact_id: |
| 11 | + description: Exact immutable candidate artifact ID from that run |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + version: |
| 15 | + description: Intended three-part semantic version (without v) |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + mode: |
| 19 | + description: Dry-run validates without publishing; publish enters the protected gate |
| 20 | + required: true |
| 21 | + default: dry-run |
| 22 | + type: choice |
| 23 | + options: [dry-run, publish] |
| 24 | + confirmation: |
| 25 | + description: Publish only - PROMOTE EXACT CANDIDATE vX.Y.Z RUN N ARTIFACT N |
| 26 | + required: false |
| 27 | + type: string |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read |
| 31 | + actions: read |
| 32 | + |
| 33 | +concurrency: |
| 34 | + group: 1helm-stable-promotion |
| 35 | + cancel-in-progress: false |
| 36 | + |
| 37 | +jobs: |
| 38 | + verify: |
| 39 | + name: Verify exact candidate bytes (never publishes) |
| 40 | + runs-on: ubuntu-latest |
| 41 | + timeout-minutes: 20 |
| 42 | + permissions: |
| 43 | + contents: read |
| 44 | + actions: read |
| 45 | + outputs: |
| 46 | + confirmation: ${{ steps.identity.outputs.confirmation }} |
| 47 | + steps: |
| 48 | + - name: Validate allowlisted dispatch inputs |
| 49 | + id: identity |
| 50 | + env: |
| 51 | + CANDIDATE_RUN_ID: ${{ inputs.candidate_workflow_run_id }} |
| 52 | + CANDIDATE_ARTIFACT_ID: ${{ inputs.candidate_artifact_id }} |
| 53 | + VERSION: ${{ inputs.version }} |
| 54 | + MODE: ${{ inputs.mode }} |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | + [[ "$CANDIDATE_RUN_ID" =~ ^[0-9]+$ ]] |
| 58 | + [[ "$CANDIDATE_ARTIFACT_ID" =~ ^[0-9]+$ ]] |
| 59 | + [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] |
| 60 | + [[ "$MODE" == dry-run || "$MODE" == publish ]] |
| 61 | + printf 'confirmation=PROMOTE EXACT CANDIDATE v%s RUN %s ARTIFACT %s\n' "$VERSION" "$CANDIDATE_RUN_ID" "$CANDIDATE_ARTIFACT_ID" >> "$GITHUB_OUTPUT" |
| 62 | +
|
| 63 | + - name: Refuse publish mode without the exact owner confirmation |
| 64 | + if: inputs.mode == 'publish' |
| 65 | + env: |
| 66 | + OWNER_CONFIRMATION: ${{ inputs.confirmation }} |
| 67 | + EXPECTED_CONFIRMATION: ${{ steps.identity.outputs.confirmation }} |
| 68 | + run: test "$OWNER_CONFIRMATION" = "$EXPECTED_CONFIRMATION" |
| 69 | + |
| 70 | + - name: Check out current main verification code |
| 71 | + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 |
| 72 | + with: |
| 73 | + ref: refs/heads/main |
| 74 | + fetch-depth: 0 |
| 75 | + persist-credentials: false |
| 76 | + |
| 77 | + - name: Fetch exact trusted GitHub identities |
| 78 | + env: |
| 79 | + GH_TOKEN: ${{ github.token }} |
| 80 | + CANDIDATE_RUN_ID: ${{ inputs.candidate_workflow_run_id }} |
| 81 | + CANDIDATE_ARTIFACT_ID: ${{ inputs.candidate_artifact_id }} |
| 82 | + run: | |
| 83 | + set -euo pipefail |
| 84 | + mkdir -m 0700 promotion-api promotion-bundle |
| 85 | + gh api "repos/$GITHUB_REPOSITORY/actions/runs/$CANDIDATE_RUN_ID" > promotion-api/run.json |
| 86 | + gh api "repos/$GITHUB_REPOSITORY/actions/artifacts/$CANDIDATE_ARTIFACT_ID" > promotion-api/artifact.json |
| 87 | +
|
| 88 | + - name: Download only the exact candidate artifact ID |
| 89 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 |
| 90 | + with: |
| 91 | + artifact-ids: ${{ inputs.candidate_artifact_id }} |
| 92 | + path: promotion-bundle |
| 93 | + merge-multiple: true |
| 94 | + github-token: ${{ github.token }} |
| 95 | + repository: ${{ github.repository }} |
| 96 | + run-id: ${{ inputs.candidate_workflow_run_id }} |
| 97 | + |
| 98 | + - name: Bind trusted candidate API records and derive the exact CI run ID |
| 99 | + id: candidate_api |
| 100 | + env: |
| 101 | + HELM_PROMOTION_BUNDLE: promotion-bundle |
| 102 | + HELM_PROMOTION_RUN_JSON: promotion-api/run.json |
| 103 | + HELM_PROMOTION_ARTIFACT_JSON: promotion-api/artifact.json |
| 104 | + run: node scripts/prepare-promotion-bundle.mjs |
| 105 | + |
| 106 | + - name: Fetch and bind the exact trusted CI run |
| 107 | + env: |
| 108 | + GH_TOKEN: ${{ github.token }} |
| 109 | + CI_RUN_ID: ${{ steps.candidate_api.outputs.ci_run_id }} |
| 110 | + HELM_PROMOTION_BUNDLE: promotion-bundle |
| 111 | + HELM_PROMOTION_RUN_JSON: promotion-api/run.json |
| 112 | + HELM_PROMOTION_ARTIFACT_JSON: promotion-api/artifact.json |
| 113 | + HELM_PROMOTION_CI_JSON: promotion-api/ci.json |
| 114 | + run: | |
| 115 | + set -euo pipefail |
| 116 | + [[ "$CI_RUN_ID" =~ ^[0-9]+$ ]] |
| 117 | + gh api "repos/$GITHUB_REPOSITORY/actions/runs/$CI_RUN_ID" > promotion-api/ci.json |
| 118 | + node scripts/prepare-promotion-bundle.mjs |
| 119 | +
|
| 120 | + - name: Cryptographically verify Linux provenance on the hosted verifier |
| 121 | + env: |
| 122 | + GH_TOKEN: ${{ github.token }} |
| 123 | + HELM_PROMOTION_BUNDLE: promotion-bundle |
| 124 | + run: node scripts/verify-promotion-attestation.mjs |
| 125 | + |
| 126 | + - name: Verify current main, absent tag, and absent release |
| 127 | + id: repository |
| 128 | + env: |
| 129 | + GH_TOKEN: ${{ github.token }} |
| 130 | + VERSION: ${{ inputs.version }} |
| 131 | + run: | |
| 132 | + set -euo pipefail |
| 133 | + main_commit="$(git rev-parse refs/remotes/origin/main)" |
| 134 | + candidate_commit="$(node -p 'require("./promotion-bundle/promotion.json").commit')" |
| 135 | + git merge-base --is-ancestor "$candidate_commit" refs/remotes/origin/main |
| 136 | + node scripts/github-promotion-gates.mjs version-absent "$VERSION" |
| 137 | + printf 'main_commit=%s\n' "$main_commit" >> "$GITHUB_OUTPUT" |
| 138 | +
|
| 139 | + - name: Verify complete evidence, exact bytes, and no-rebuild promotion outputs |
| 140 | + env: |
| 141 | + VERSION: ${{ inputs.version }} |
| 142 | + CANDIDATE_RUN_ID: ${{ inputs.candidate_workflow_run_id }} |
| 143 | + CANDIDATE_ARTIFACT_ID: ${{ inputs.candidate_artifact_id }} |
| 144 | + HELM_PROMOTION_MAIN_COMMIT: ${{ steps.repository.outputs.main_commit }} |
| 145 | + HELM_PROMOTION_MAIN_CONTAINS_CANDIDATE: "1" |
| 146 | + HELM_PROMOTION_TAG_ABSENT: "1" |
| 147 | + HELM_PROMOTION_RELEASE_ABSENT: "1" |
| 148 | + HELM_PROMOTION_LINUX_ATTESTATION_VERIFIED: "1" |
| 149 | + run: | |
| 150 | + set -euo pipefail |
| 151 | + node scripts/promotion-status.mjs \ |
| 152 | + --bundle promotion-bundle \ |
| 153 | + --version "$VERSION" \ |
| 154 | + --candidate-run "$CANDIDATE_RUN_ID" \ |
| 155 | + --candidate-artifact "$CANDIDATE_ARTIFACT_ID" \ |
| 156 | + --write-verified promotion-bundle |
| 157 | +
|
| 158 | + - name: Retain verified exact bytes only for an explicitly confirmed publish request |
| 159 | + if: >- |
| 160 | + inputs.mode == 'publish' && |
| 161 | + inputs.confirmation == steps.identity.outputs.confirmation |
| 162 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 163 | + with: |
| 164 | + name: verified-stable-promotion-${{ inputs.candidate_artifact_id }} |
| 165 | + path: | |
| 166 | + promotion-bundle/1Helm-${{ inputs.version }}-arm64.dmg |
| 167 | + promotion-bundle/1Helm-${{ inputs.version }}-mac-arm64.zip |
| 168 | + promotion-bundle/1Helm-${{ inputs.version }}-linux-node.tgz |
| 169 | + promotion-bundle/1Helm-${{ inputs.version }}-stable.json |
| 170 | + promotion-bundle/1Helm-${{ inputs.version }}-release-notes.md |
| 171 | + promotion-bundle/verified-promotion.json |
| 172 | + if-no-files-found: error |
| 173 | + retention-days: 1 |
| 174 | + |
| 175 | + publish: |
| 176 | + name: Protected owner approval - publish Stable |
| 177 | + needs: verify |
| 178 | + if: >- |
| 179 | + inputs.mode == 'publish' && |
| 180 | + inputs.confirmation == needs.verify.outputs.confirmation |
| 181 | + runs-on: ubuntu-latest |
| 182 | + timeout-minutes: 10 |
| 183 | + environment: Stable publication |
| 184 | + permissions: |
| 185 | + contents: write |
| 186 | + actions: read |
| 187 | + steps: |
| 188 | + - name: Check out current main for the guarded tag push |
| 189 | + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 |
| 190 | + with: |
| 191 | + ref: refs/heads/main |
| 192 | + fetch-depth: 0 |
| 193 | + persist-credentials: true |
| 194 | + |
| 195 | + - name: Download the complete verified promotion output |
| 196 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 |
| 197 | + with: |
| 198 | + name: verified-stable-promotion-${{ inputs.candidate_artifact_id }} |
| 199 | + path: verified-promotion |
| 200 | + |
| 201 | + - name: Publish annotated immutable tag and one complete GitHub Release |
| 202 | + env: |
| 203 | + GH_TOKEN: ${{ github.token }} |
| 204 | + STABLE_PUBLICATION_ENABLED: ${{ secrets.STABLE_PUBLICATION_ENABLED }} |
| 205 | + HELM_PROMOTION_BUNDLE: verified-promotion |
| 206 | + HELM_PROMOTION_MODE: ${{ inputs.mode }} |
| 207 | + HELM_PROMOTION_VERSION: ${{ inputs.version }} |
| 208 | + HELM_PROMOTION_RUN_ID: ${{ inputs.candidate_workflow_run_id }} |
| 209 | + HELM_PROMOTION_ARTIFACT_ID: ${{ inputs.candidate_artifact_id }} |
| 210 | + HELM_PROMOTION_CONFIRMATION: ${{ inputs.confirmation }} |
| 211 | + run: node scripts/publish-promotion.mjs |
0 commit comments