Build homebrew bottles #216
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-12, name: "monterey" } ] | |
# we don't bottle meta-formulas that contain only services | |
formula: [tezos-accuser-PtMumbai, tezos-accuser-PtNairob, tezos-admin-client, tezos-baker-PtMumbai, tezos-baker-PtNairob, tezos-client, tezos-codec, tezos-node, tezos-signer, tezos-smart-rollup-client-PtMumbai, tezos-smart-rollup-client-PtNairob, tezos-smart-rollup-node-PtMumbai, tezos-smart-rollup-node-PtNairob] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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@v2 | |
with: | |
name: homebrew-bottles-${{ matrix.os }} | |
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-12 | |
needs: build-bottles | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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 Monterey bottles from the release | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: gh release download "${{ github.ref_name }}" -p "*.monterey.bottle.tar.gz" -D "./Monterey" | |
- name: Add bottle hashes to formulae | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: ./scripts/sync-bottle-hashes.sh "${{ github.ref_name }}" "Monterey" |