|
| 1 | +name: Full Release Candidate |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + ref: |
| 7 | + description: Exact target commit SHA |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + request_json: |
| 11 | + description: Canonical full release candidate request |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + request_sha256: |
| 15 | + description: Canonical request digest |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + outputs: |
| 19 | + state: |
| 20 | + description: Candidate acquisition state |
| 21 | + value: ${{ jobs.finalize.outputs.state }} |
| 22 | + source: |
| 23 | + description: Whether the ready candidate was reused or freshly produced |
| 24 | + value: ${{ jobs.finalize.outputs.source }} |
| 25 | + reuse_reason: |
| 26 | + description: Candidate acquisition result |
| 27 | + value: ${{ jobs.discover.outputs.reuse_reason }} |
| 28 | + request_json: |
| 29 | + description: Validated canonical request |
| 30 | + value: ${{ jobs.discover.outputs.request_json }} |
| 31 | + request_sha256: |
| 32 | + description: Validated request digest |
| 33 | + value: ${{ jobs.discover.outputs.request_sha256 }} |
| 34 | + binding_json: |
| 35 | + description: Validated immutable candidate binding |
| 36 | + value: ${{ jobs.finalize.outputs.binding_json }} |
| 37 | + candidate_artifact_json: |
| 38 | + description: Candidate artifact tuple for child workflows |
| 39 | + value: ${{ jobs.finalize.outputs.candidate_artifact_json }} |
| 40 | + |
| 41 | +permissions: |
| 42 | + actions: read |
| 43 | + contents: read |
| 44 | + packages: read |
| 45 | + pull-requests: read |
| 46 | + |
| 47 | +concurrency: |
| 48 | + # Every waiter rechecks after taking the request lock. Only a proven miss can |
| 49 | + # become the single producer for these exact candidate bytes. |
| 50 | + group: full-release-candidate-${{ inputs.request_sha256 }} |
| 51 | + cancel-in-progress: false |
| 52 | + queue: max |
| 53 | + |
| 54 | +env: |
| 55 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" |
| 56 | + |
| 57 | +jobs: |
| 58 | + discover: |
| 59 | + name: Find trusted release candidate |
| 60 | + runs-on: ubuntu-24.04 |
| 61 | + timeout-minutes: 10 |
| 62 | + outputs: |
| 63 | + state: ${{ steps.discover.outputs.state }} |
| 64 | + reuse_reason: ${{ steps.discover.outputs.reuse_reason }} |
| 65 | + request_json: ${{ steps.discover.outputs.request_json }} |
| 66 | + request_sha256: ${{ steps.discover.outputs.request_sha256 }} |
| 67 | + binding_json: ${{ steps.discover.outputs.binding_json }} |
| 68 | + steps: |
| 69 | + - name: Checkout trusted candidate discovery |
| 70 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 71 | + with: |
| 72 | + ref: ${{ github.sha }} |
| 73 | + sparse-checkout: | |
| 74 | + scripts/full-release-candidate-contract.mjs |
| 75 | + scripts/full-release-candidate-reuse.mjs |
| 76 | + scripts/full-release-validation-policy.mjs |
| 77 | + scripts/lib/actions-artifact-archive.mjs |
| 78 | + scripts/lib/canonical-json.mjs |
| 79 | + scripts/lib/full-release-candidate-reuse.mjs |
| 80 | + scripts/lib/record-shared.mjs |
| 81 | + scripts/lib/upgrade-survivor-policy.mjs |
| 82 | + sparse-checkout-cone-mode: false |
| 83 | + persist-credentials: false |
| 84 | + |
| 85 | + - name: Discover trusted release candidate |
| 86 | + id: discover |
| 87 | + env: |
| 88 | + CANDIDATE_REQUEST_JSON: ${{ inputs.request_json }} |
| 89 | + EXPECTED_REQUEST_SHA256: ${{ inputs.request_sha256 }} |
| 90 | + GH_TOKEN: ${{ github.token }} |
| 91 | + run: | |
| 92 | + set -euo pipefail |
| 93 | + request_input="${RUNNER_TEMP}/full-release-candidate-request.json" |
| 94 | + printf '%s\n' "$CANDIDATE_REQUEST_JSON" > "$request_input" |
| 95 | + node scripts/full-release-candidate-reuse.mjs discover \ |
| 96 | + --request-input "$request_input" \ |
| 97 | + --expected-request-sha256 "$EXPECTED_REQUEST_SHA256" |
| 98 | +
|
| 99 | + - name: Summarize release candidate discovery |
| 100 | + env: |
| 101 | + STATE: ${{ steps.discover.outputs.state }} |
| 102 | + REUSE_REASON: ${{ steps.discover.outputs.reuse_reason }} |
| 103 | + REQUEST_SHA256: ${{ steps.discover.outputs.request_sha256 }} |
| 104 | + run: | |
| 105 | + { |
| 106 | + echo "## Release candidate acquisition" |
| 107 | + echo |
| 108 | + echo "- Request: \`${REQUEST_SHA256}\`" |
| 109 | + echo "- State: \`${STATE}\`" |
| 110 | + echo "- Result: ${REUSE_REASON}" |
| 111 | + } >> "$GITHUB_STEP_SUMMARY" |
| 112 | +
|
| 113 | + prepare: |
| 114 | + name: Prepare shared release candidate |
| 115 | + needs: discover |
| 116 | + if: ${{ needs.discover.result == 'success' && needs.discover.outputs.state == 'miss' }} |
| 117 | + permissions: |
| 118 | + actions: read |
| 119 | + contents: read |
| 120 | + packages: read |
| 121 | + pull-requests: read |
| 122 | + uses: ./.github/workflows/openclaw-live-and-e2e-checks-reusable.yml |
| 123 | + with: |
| 124 | + ref: ${{ inputs.ref }} |
| 125 | + prepare_only: true |
| 126 | + emit_candidate_evidence: true |
| 127 | + release_soak: ${{ fromJSON(inputs.request_json).releaseSoak }} |
| 128 | + include_repo_e2e: false |
| 129 | + include_release_path_suites: false |
| 130 | + include_openwebui: false |
| 131 | + include_live_suites: false |
| 132 | + enable_prepublish_plugin_registry: true |
| 133 | + published_upgrade_survivor_scenarios: ${{ join(fromJSON(inputs.request_json).upgradeSurvivorScenarios, ',') }} |
| 134 | + allow_frozen_target_scenario_omissions: ${{ fromJSON(inputs.request_json).allowFrozenTargetScenarioOmissions }} |
| 135 | + allow_unreleased_changelog: ${{ fromJSON(inputs.request_json).allowUnreleasedChangelog }} |
| 136 | + release_test_profile: ${{ fromJSON(inputs.request_json).releaseProfile }} |
| 137 | + shared_image_artifact_namespace: full-release |
| 138 | + shared_image_policy: ${{ fromJSON(inputs.request_json).sharedImagePolicy }} |
| 139 | + |
| 140 | + resolve_candidate: |
| 141 | + name: Resolve release candidate |
| 142 | + needs: [discover, prepare] |
| 143 | + if: ${{ always() && needs.discover.result == 'success' && (needs.prepare.result == 'success' || needs.prepare.result == 'skipped') }} |
| 144 | + runs-on: ubuntu-24.04 |
| 145 | + timeout-minutes: 5 |
| 146 | + outputs: |
| 147 | + state: ${{ steps.resolve.outputs.state }} |
| 148 | + source: ${{ steps.resolve.outputs.source }} |
| 149 | + binding_json: ${{ steps.resolve.outputs.binding_json }} |
| 150 | + candidate_artifact_json: ${{ steps.resolve.outputs.candidate_artifact_json }} |
| 151 | + steps: |
| 152 | + - name: Checkout candidate binding authority |
| 153 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 154 | + with: |
| 155 | + ref: ${{ github.sha }} |
| 156 | + sparse-checkout: | |
| 157 | + scripts/full-release-candidate-contract.mjs |
| 158 | + scripts/full-release-candidate-reuse.mjs |
| 159 | + scripts/full-release-validation-policy.mjs |
| 160 | + scripts/lib/actions-artifact-archive.mjs |
| 161 | + scripts/lib/canonical-json.mjs |
| 162 | + scripts/lib/full-release-candidate-reuse.mjs |
| 163 | + scripts/lib/record-shared.mjs |
| 164 | + scripts/lib/upgrade-survivor-policy.mjs |
| 165 | + sparse-checkout-cone-mode: false |
| 166 | + persist-credentials: false |
| 167 | + |
| 168 | + - name: Resolve candidate binding |
| 169 | + id: resolve |
| 170 | + env: |
| 171 | + CANDIDATE_REQUEST_JSON: ${{ needs.discover.outputs.request_json }} |
| 172 | + DISCOVERY_STATE: ${{ needs.discover.outputs.state }} |
| 173 | + FRESH_CANDIDATE_BINDING_JSON: ${{ needs.prepare.outputs.candidate_evidence_json }} |
| 174 | + REUSED_CANDIDATE_BINDING_JSON: ${{ needs.discover.outputs.binding_json }} |
| 175 | + run: | |
| 176 | + set -euo pipefail |
| 177 | + input="${RUNNER_TEMP}/full-release-candidate-binding-input.json" |
| 178 | + jq -cn \ |
| 179 | + --argjson required true \ |
| 180 | + --argjson request "$CANDIDATE_REQUEST_JSON" \ |
| 181 | + --argjson freshBinding "${FRESH_CANDIDATE_BINDING_JSON:-null}" \ |
| 182 | + --argjson reusedBinding "${REUSED_CANDIDATE_BINDING_JSON:-null}" \ |
| 183 | + '$ARGS.named' > "$input" |
| 184 | + result="$(node scripts/full-release-candidate-reuse.mjs resolve --input "$input")" |
| 185 | + { |
| 186 | + printf 'state=ready\n' |
| 187 | + if [[ "$DISCOVERY_STATE" == "hit" ]]; then |
| 188 | + printf 'source=reused\n' |
| 189 | + else |
| 190 | + printf 'source=fresh\n' |
| 191 | + fi |
| 192 | + printf 'binding_json=%s\n' "$(jq -c '.binding' <<< "$result")" |
| 193 | + printf 'candidate_artifact_json=%s\n' "$(jq -r '.candidateArtifactJson' <<< "$result")" |
| 194 | + } >> "$GITHUB_OUTPUT" |
| 195 | +
|
| 196 | + finalize: |
| 197 | + name: Finalize release candidate acquisition |
| 198 | + needs: [discover, prepare, resolve_candidate] |
| 199 | + if: always() |
| 200 | + runs-on: ubuntu-24.04 |
| 201 | + timeout-minutes: 5 |
| 202 | + outputs: |
| 203 | + state: ${{ steps.result.outputs.state }} |
| 204 | + source: ${{ steps.result.outputs.source }} |
| 205 | + binding_json: ${{ steps.result.outputs.binding_json }} |
| 206 | + candidate_artifact_json: ${{ steps.result.outputs.candidate_artifact_json }} |
| 207 | + steps: |
| 208 | + - name: Record candidate acquisition result |
| 209 | + id: result |
| 210 | + env: |
| 211 | + DISCOVERY_RESULT: ${{ needs.discover.result }} |
| 212 | + DISCOVERY_STATE: ${{ needs.discover.outputs.state }} |
| 213 | + PREPARE_RESULT: ${{ needs.prepare.result }} |
| 214 | + RESOLVE_RESULT: ${{ needs.resolve_candidate.result }} |
| 215 | + RESOLVED_STATE: ${{ needs.resolve_candidate.outputs.state }} |
| 216 | + RESOLVED_SOURCE: ${{ needs.resolve_candidate.outputs.source }} |
| 217 | + BINDING_JSON: ${{ needs.resolve_candidate.outputs.binding_json }} |
| 218 | + CANDIDATE_ARTIFACT_JSON: ${{ needs.resolve_candidate.outputs.candidate_artifact_json }} |
| 219 | + run: | |
| 220 | + set -euo pipefail |
| 221 | + state=unavailable |
| 222 | + source="" |
| 223 | + binding_json="" |
| 224 | + candidate_artifact_json="" |
| 225 | + if [[ "$DISCOVERY_RESULT" == "success" && |
| 226 | + "$DISCOVERY_STATE" != "unavailable" && |
| 227 | + "$PREPARE_RESULT" =~ ^(success|skipped)$ && |
| 228 | + "$RESOLVE_RESULT" == "success" && |
| 229 | + "$RESOLVED_STATE" == "ready" ]]; then |
| 230 | + state=ready |
| 231 | + source="$RESOLVED_SOURCE" |
| 232 | + binding_json="$BINDING_JSON" |
| 233 | + candidate_artifact_json="$CANDIDATE_ARTIFACT_JSON" |
| 234 | + fi |
| 235 | + { |
| 236 | + printf 'state=%s\n' "$state" |
| 237 | + printf 'source=%s\n' "$source" |
| 238 | + printf 'binding_json=%s\n' "$binding_json" |
| 239 | + printf 'candidate_artifact_json=%s\n' "$candidate_artifact_json" |
| 240 | + } >> "$GITHUB_OUTPUT" |
| 241 | +
|
| 242 | + - name: Enforce candidate acquisition |
| 243 | + env: |
| 244 | + STATE: ${{ steps.result.outputs.state }} |
| 245 | + run: | |
| 246 | + set -euo pipefail |
| 247 | + if [[ "$STATE" == "ready" ]]; then |
| 248 | + exit 0 |
| 249 | + fi |
| 250 | + echo "::error::Release candidate acquisition is unavailable." |
| 251 | + exit 1 |
0 commit comments