Something went wrong. Try again.
cee sky
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465#!/usr/bin/env bashset -euo pipefailsource tooling/scripts/release/common.sh[[ "$PREPARED_SHA" =~ ^[0-9a-f]{40}$ ]] || fail 'Expected full prepared SHA.'[[ "$(git -C source rev-parse HEAD)" == "$PREPARED_SHA" ]] || fail 'Checkout does not match prepared SHA.'[[ "$(git -C source show -s --format=%P HEAD)" == "$BASE_SHA" ]] || fail 'Prepared commit must have exactly the selected source as its parent.'[[ "$(git -C source diff-tree --no-commit-id --name-status -r HEAD)" == $'A\t'"$FILE" ]] || fail 'Prepared commit must only add the release document.'[[ "$(git -C source ls-tree HEAD -- "$FILE" | cut -d ' ' -f 1)" == 100644 ]] || fail 'Release document must be a regular file.'validate_source preparedverify_prepared# Validate all reservations before any write or dispatch.for platform in ios android web; do reservation=$(ref_sha "heads/release-build-$VERSION-$platform") [[ -z "$reservation" || "$reservation" == "$PREPARED_SHA" ]] || fail "Conflicting $platform build reservation."donesummary "Validated $BRANCH at $PREPARED_SHA (source $BASE_SHA)."generate_notesverify_preparedif [[ -z "$(ref_sha "tags/$VERSION")" ]]; then api git/refs -X POST -f "ref=refs/tags/$VERSION" -f "sha=$PREPARED_SHA" >/dev/null summary "Created tag $VERSION at $PREPARED_SHA."fiREQUIRE_TAG=trueverify_preparedif [[ "$RELEASES" == '[]' ]]; then gh release create "$VERSION" --verify-tag --target "$PREPARED_SHA" --draft \ --title "Release $VERSION" --notes-file "$RUNNER_TEMP/notes.md"else gh release edit "$VERSION" --notes-file "$RUNNER_TEMP/notes.md"fiREQUIRE_DRAFT=trueverify_preparedsummary "Draft notes updated for $VERSION."
if [[ "$START_BUILDS" != true ]]; then summary 'Build dispatch disabled. Existing builds were not changed.' exit 0fiplatforms=(ios android web)for index in 0 1 2; do platform=${platforms[$index]} workflow=${WORKFLOWS[$index]} verify_prepared reservation="heads/release-build-$VERSION-$platform" if [[ -n "$(ref_sha "$reservation")" ]]; then summary "$platform dispatch was previously reserved. No new build started; inspect Actions and rerun failed build jobs if needed." continue fi api "actions/workflows/$workflow" | jq -e '.state == "active"' >/dev/null # Reserve before dispatch: a timeout must never cause an automatic duplicate build. api git/refs -X POST -f "ref=refs/$reservation" -f "sha=$PREPARED_SHA" >/dev/null summary "$platform dispatch reserved for $PREPARED_SHA. If no run link follows, inspect Actions before recovery." verify_prepared case "$platform" in ios) inputs='{"profile":"production","submit":"false","testFlightGroup":"none"}' ;; android) inputs='{"profile":"production","submit":"false"}' ;; web) inputs='{}' ;; esac jq -n --arg ref "$VERSION" --arg sha "$PREPARED_SHA" --argjson inputs "$inputs" \ '{ref: $ref, inputs: ($inputs + {sourceRef: $sha}), return_run_details: true}' > "$RUNNER_TEMP/dispatch.json" api "actions/workflows/$workflow/dispatches" -X POST --input "$RUNNER_TEMP/dispatch.json" > "$RUNNER_TEMP/run.json" jq -e '.workflow_run_id > 0 and (.html_url | type == "string")' "$RUNNER_TEMP/run.json" >/dev/null || fail 'Dispatch outcome uncertain; inspect Actions before retrying.' summary "$platform build: $(jq -r .html_url "$RUNNER_TEMP/run.json"). Dispatched does not mean successful."done