-
Notifications
You must be signed in to change notification settings - Fork 21
97 lines (83 loc) · 3.78 KB
/
build-bottles.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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-PtNairob, tezos-accuser-Proxford, tezos-admin-client, tezos-baker-PtNairob, tezos-baker-Proxford, tezos-client, tezos-codec, tezos-node, tezos-signer, tezos-smart-rollup-client-PtNairob, tezos-smart-rollup-client-Proxford, tezos-smart-rollup-node-PtNairob, tezos-smart-rollup-node-Proxford, tezos-dac-client, tezos-dac-node, tezos-smart-rollup-wasm-debugger]
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"