Merge pull request #826 from serokell/auto/v21.0-release #229
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build homebrew bottles | |
on: | |
# Run when a release is tagged | |
push: | |
tags: | |
- "v*" | |
permissions: | |
# Restrict GITHUB_TOKEN permissions | |
contents: write | |
pull-requests: write | |
jobs: | |
build-bottles: | |
runs-on: ${{ matrix.os.id }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ { id: macos-13, name: "ventura" } ] | |
# we don't bottle meta-formulas that contain only services | |
formula: [tezos-smart-rollup-wasm-debugger, tezos-smart-rollup-node, tezos-dac-client, tezos-dac-node, tezos-dal-node, tezos-signer, tezos-codec, tezos-client, tezos-admin-client, tezos-node, tezos-accuser-PsQuebec, tezos-baker-PsQuebec, tezos-accuser-PsParisC, tezos-baker-PsParisC] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install GNU sed | |
run: | | |
brew install gnu-sed | |
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | |
- id: extract-tag | |
name: Extract the right version from the formula | |
run: echo "tag=$(sed -n 's/^\s\+version \"\(.*\)\"/\1/p' ./Formula/${{ matrix.formula }}.rb)" >> $GITHUB_ENV | |
- id: check-built | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
name: Check if the bottle has already been built | |
continue-on-error: true | |
run: gh release view "${{ env.tag }}" | grep "${{ matrix.formula }}.*\.${{ matrix.os.name }}.bottle.tar.gz" | |
# tezos-sapling-params is used as a dependency for some of the formulas | |
# so we handle it separately. | |
# We don't build the bottle for it because it is never updated over time. | |
- name: Build tezos-sapling-params | |
if: steps.check-built.outcome == 'failure' | |
run: brew install --formula ./Formula/tezos-sapling-params.rb | |
- name: Build the bottle | |
if: steps.check-built.outcome == 'failure' | |
run: ./scripts/build-one-bottle.sh "${{ matrix.formula }}" | |
timeout-minutes: 120 | |
- name: Upload the bottle to Github Actions | |
if: steps.check-built.outcome == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.formula }}-${{ github.run_id }} | |
path: '*.bottle.*' | |
- name: Attach the bottle to the release | |
if: steps.check-built.outcome == 'failure' | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: gh release upload "${{ env.tag }}" *.bottle.* | |
sync-hashes: | |
runs-on: macos-13 | |
needs: build-bottles | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install GNU sed | |
run: | | |
brew install gnu-sed | |
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | |
- name: Install coreutils for macOS # for sha256sum | |
run: brew install coreutils | |
# Since using the tag that triggered the pipeline isn't very resilient, we use the version | |
# from the tezos-client formula, which hopefully will stay the most up-to-date. | |
- id: extract-tag | |
name: Extract the right version from the formula | |
run: echo "tag=$(sed -n 's/^\s\+version \"\(.*\)\"/\1/p' ./Formula/tezos-client.rb)" >> $GITHUB_ENV | |
# It's possible we have had to rerun the building workflow, skipping some jobs and | |
# erasing the previously built bottles, so we use the release to download them all | |
- name: Download Ventura bottles from the release | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: gh release download "${{ github.ref_name }}" -p "*.ventura.bottle.tar.gz" -D "./Ventura" | |
- name: Add bottle hashes to formulae | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: ./scripts/sync-bottle-hashes.sh "${{ github.ref_name }}" "Ventura" |