Skip to content

Commit

Permalink
publish-commit-bottles: refactor to avoid retry
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
woodruffw committed May 7, 2024
1 parent bc8d552 commit c678d71
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/publish-commit-bottles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,13 @@ jobs:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh pr checkout "$PR"

- name: Pull and upload bottles to GitHub Packages
- name: Pull PR bottles
id: pr-pull
working-directory: ${{steps.set-up-homebrew.outputs.repository-path}}
env:
BREWTESTBOT_NAME_EMAIL: "BrewTestBot <[email protected]>"
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_CORE_PUBLIC_REPO_EMAIL_TOKEN}}
HOMEBREW_GITHUB_PACKAGES_USER: brewtestbot
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_CORE_GITHUB_PACKAGES_TOKEN}}
EXPECTED_SHA: ${{needs.check.outputs.head_sha}}
LARGE_RUNNER: ${{inputs.large_runner}}
run: |
Expand All @@ -323,6 +321,7 @@ jobs:
# Don't quote arguments that might be empty; this causes errors.
brew pr-pull \
--no-upload \
--debug \
--clean \
--no-cherry-pick \
Expand All @@ -337,23 +336,26 @@ jobs:
echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Generate build provenance
# GitHub Attestations are still in early public access, and we've seen
# some sporadic errors when generating attestations.
# Rather than fail outright, we allow this step to fail and fall
# through to a last-ditch retry below. Longer term, we should put this
# above the 'pr-pull' step, which should be split into separate 'pull'
# and 'push to GitHub Packages' phases.
continue-on-error: true
id: first-attestation-attempt
uses: actions/attest-build-provenance@v1
with:
subject-path: '${{steps.pr-pull.outputs.bottle_path}}/*.tar.gz'

- name: Generate build provenance (last ditch)
if: always() && steps.first-attestation-attempt.outcome == 'failure'
uses: actions/attest-build-provenance@v1
with:
subject-path: '${{steps.pr-pull.outputs.bottle_path}}/*.tar.gz'
- name: Upload bottles to GitHub Packages
id: pr-upload
working-directory: ${{steps.set-up-homebrew.outputs.repository-path}}
env:
BREWTESTBOT_NAME_EMAIL: "BrewTestBot <[email protected]>"
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_CORE_PUBLIC_REPO_EMAIL_TOKEN}}
HOMEBREW_GITHUB_PACKAGES_USER: brewtestbot
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_CORE_GITHUB_PACKAGES_TOKEN}}
run: |
# Don't quote arguments that might be empty; this causes errors.
brew pr-upload \
--debug \
--committer="$BREWTESTBOT_NAME_EMAIL" \
--root-url="https://ghcr.io/v2/homebrew/core" \
${{inputs.warn_on_upload_failure && '--warn-on-upload-failure' || ''}} \
"$PR"
- name: Push commits
uses: Homebrew/actions/git-try-push@master
Expand Down

0 comments on commit c678d71

Please sign in to comment.