99 - " v*"
1010
1111jobs :
12- linux :
12+ build :
1313 strategy :
1414 matrix :
1515 platform :
16- - linux
16+ - name : linux
17+ os : ubuntu-20.04
18+ - name : darwin
19+ os : macos-latest
1720 arch :
1821 - arm64
1922 - amd64
20- name : Build binaries for ${{ matrix.platform }} platform ( ${{ matrix.arch }})
21- runs-on : ubuntu-20.04
23+ name : Build binaries for ${{ matrix.platform.name }}- ${{ matrix.arch }}
24+ runs-on : ${{ matrix.platform.os }}
2225 steps :
23- - name : Export OS and platform env
24- run : |
25- echo "GOOS=${{ matrix.platform }}" >> $GITHUB_ENV
26- echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
27-
28- - name : Set up go
29- id : go
30- uses : actions/setup-go@v3
31- with :
32- go-version : 1.19
33-
3426 - name : Check out code
3527 uses : actions/checkout@v3
3628 with :
3729 fetch-depth : 0
30+ # Check https://github.com/livepeer/go-livepeer/pull/1891
31+ # for ref value discussion
3832 ref : ${{ github.event.pull_request.head.sha }}
3933
40- - name : Restore cache
41- id : cache-go-mod
42- uses : actions/cache@v3
43- with :
44- path : |
45- ~/.cache/go-build
46- ~/go/pkg/mod
47- key : ${{ runner.os }}-${{ matrix.arch }}-go-${{ hashFiles('**/go.sum') }}
48- restore-keys : |
49- ${{ runner.os }}-${{ matrix.arch }}-go-
50-
51- - name : Download dependencies
52- if : steps.cache-go-mod.outputs.cache-hit != 'true'
53- run : go mod download
54-
55- - name : Build
56- run : |
57- mkdir -p build/ releases/
58- make build GO_BUILD_DIR="build/"
59-
60- - name : Archive binaries for windows
61- if : matrix.platform == 'windows'
62- run : |
63- cd build/
64- for file in $(find . -type f -perm -a+x)
65- do
66- f_name="$(basename $file)"
67- mv "${f_name}" "livepeer-${f_name}"
68- zip -9q "../releases/livepeer-${f_name/.exe/}-${GOOS}-${GOARCH}.zip" "livepeer-${f_name}"
69- done
70-
71- - name : Archive binaries for linux
72- if : matrix.platform == 'linux'
73- run : |
74- cd build/
75- for file in $(find . -type f -perm -a+x)
76- do
77- f_name="$(basename $file)"
78- mv "${f_name}" "livepeer-${f_name}"
79- tar -czf "../releases/livepeer-${f_name}-${GOOS}-${GOARCH}.tar.gz" "livepeer-${f_name}"
80- done
81-
82- - name : Upload artifacts for cutting release
83- uses : actions/upload-artifact@master
84- with :
85- name : release-artifacts
86- path : releases/
87-
88- macos :
89- strategy :
90- matrix :
91- arch :
92- - arm64
93- - amd64
94- name : Build binaries for macOS platform
95- runs-on : macos-11
96- steps :
9734 - name : Set up go
9835 id : go
9936 uses : actions/setup-go@v3
10037 with :
101- go-version : 1.19
102-
103- - name : Check out code
104- uses : actions/checkout@v3
105- with :
106- fetch-depth : 0
107- # Check https://github.com/livepeer/go-livepeer/pull/1891
108- # for ref value discussion
109- ref : ${{ github.event.pull_request.head.sha }}
38+ go-version-file : go.mod
39+ cache : true
40+ cache-dependency-path : go.sum
11041
111- - name : Restore cache
112- id : cache-go-mod
113- uses : actions/cache@v3
114- with :
115- path : |
116- ~/.cache/go-build
117- ~/go/pkg/mod
118- key : ${{ runner.os }}-${{ matrix.arch }}-go-${{ hashFiles('**/go.sum') }}
119- restore-keys : |
120- ${{ runner.os }}-${{ matrix.arch }}-go-
42+ - name : Export OS and platform env
43+ run : |
44+ echo "GOOS=${{ matrix.platform.name }}" >> $GITHUB_ENV
45+ echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
12146
12247 - name : Download dependencies
123- if : steps.cache-go-mod .outputs.cache-hit != 'true'
48+ if : steps.go .outputs.cache-hit != 'true'
12449 run : go mod download
12550
12651 - name : Build
12752 run : |
12853 mkdir -p build/ releases/
129- GOARCH="${{ matrix.arch }}" make -j4 build GO_BUILD_DIR="build/"
54+ make build GO_BUILD_DIR="build/"
13055 cd build/
131- for file in $(find . -type f -perm -a+x)
132- do
133- f_name="$(basename $file)"
134- mv "${f_name}" "livepeer-${f_name}"
135- done
136- cd -
56+ mv catalyst-api livepeer-catalyst-api
13757
13858 - uses : actions-ecosystem/action-regex-match@v2
13959 id : match-tag
@@ -142,29 +62,89 @@ jobs:
14262 regex : ' ^(master|main|v[0-9]+\.\d+\.\d+)$'
14363
14464 - name : Codesign and notarize binaries
145- if : ${{ steps.match-tag.outputs.match != '' }}
65+ if : ${{ matrix.platform.name == 'darwin' && steps.match-tag.outputs.match != '' }}
14666 uses : livepeer/action-gh-codesign-apple@latest
14767 with :
14868 developer-certificate-id : ${{ secrets.CI_MACOS_CERTIFICATE_ID }}
14969 developer-certificate-base64 : ${{ secrets.CI_MACOS_CERTIFICATE_BASE64 }}
15070 developer-certificate-password : ${{ secrets.CI_MACOS_CERTIFICATE_PASSWORD }}
15171 app-notarization-email : ${{ secrets.CI_MACOS_NOTARIZATION_USER }}
15272 app-notarization-password : ${{ secrets.CI_MACOS_NOTARIZATION_PASSWORD }}
153- binary-path : " build/"
154- app-bundle-id : " org.livepeer.lapi "
73+ binary-path : build/livepeer-catalyst-api
74+ app-bundle-id : org.livepeer.catalyst-api
15575
156- - name : Archive signed binary
76+ - name : Archive binaries for windows
77+ if : matrix.platform.name == 'windows'
15778 run : |
15879 cd build/
15980 for file in $(find . -type f -perm -a+x)
16081 do
16182 f_name="$(basename $file)"
162- tar -czf "../releases/${f_name}-darwin-${{ matrix.arch }}.tar.gz" "${f_name}"
83+ mv "${f_name}" "livepeer-${f_name}"
84+ zip -9q "../releases/livepeer-${f_name/.exe/}-${GOOS}-${GOARCH}.zip" "livepeer-${f_name}"
16385 done
164- cd -
86+
87+ - name : Archive binaries
88+ if : matrix.platform.name != 'windows'
89+ run : |
90+ cd build/
91+ tar -czvf "../releases/livepeer-catalyst-api-${GOOS}-${GOARCH}.tar.gz" ./livepeer-catalyst-api
16592
16693 - name : Upload artifacts for cutting release
16794 uses : actions/upload-artifact@master
16895 with :
16996 name : release-artifacts
17097 path : releases/
98+
99+ upload :
100+ name : Upload artifacts to google bucket
101+ permissions :
102+ contents : " read"
103+ id-token : " write"
104+ runs-on : ubuntu-latest
105+ needs :
106+ - build
107+ steps :
108+ - name : Download artifacts
109+ uses : actions/download-artifact@v3
110+ with :
111+ name : release-artifacts
112+ path : releases/
113+
114+ - name : Generate sha256 checksum and gpg signatures for release artifacts
115+ uses : livepeer/action-gh-checksum-and-gpg-sign@latest
116+ with :
117+ artifacts-dir : releases
118+ release-name : ${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
119+ gpg-key : ${{ secrets.CI_GPG_SIGNING_KEY }}
120+ gpg-key-passphrase : ${{ secrets.CI_GPG_SIGNING_PASSPHRASE }}
121+
122+ - name : Generate branch manifest
123+ id : branch-manifest
124+ uses : livepeer/branch-manifest-action@latest
125+ with :
126+ project-name : ${{ github.event.repository.name }}
127+ platform : linux, darwin
128+
129+ - name : Authenticate to Google Cloud
130+ id : auth
131+ uses : google-github-actions/auth@v0
132+ with :
133+ workload_identity_provider : ${{ secrets.CI_GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
134+ service_account : ${{ secrets.CI_GOOGLE_SERVICE_ACCOUNT }}
135+
136+ - name : Upload release archives to Google Cloud
137+ id : upload-archives
138+ uses : google-github-actions/upload-cloud-storage@v0
139+ with :
140+ path : ' releases'
141+ destination : " build.livepeer.live/${{ github.event.repository.name }}/${{ (github.ref_type == 'tag' && github.ref_name) || github.sha }}"
142+ parent : false
143+
144+ - name : Upload branch manifest file
145+ id : upload-manifest
146+ uses : google-github-actions/upload-cloud-storage@v0
147+ with :
148+ path : ${{ steps.branch-manifest.outputs.manifest-file }}
149+ destination : ' build.livepeer.live/${{ github.event.repository.name }}/'
150+ parent : false
0 commit comments