-
Notifications
You must be signed in to change notification settings - Fork 13
151 lines (130 loc) · 4.8 KB
/
build.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build and upload binaries to GCP
on:
pull_request:
push:
paths-ignore:
- "**/*.md"
branches:
- main
- staging
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
CI_CATALYST_BIN_DIR: "bin"
jobs:
build:
name: "Download binaries for ${{ matrix.platform }}-${{ matrix.architecture }}"
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
architecture:
- amd64
platform:
- linux
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up go
id: go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Install go modules
if: steps.go.outputs.cache-hit != 'true'
run: go mod download
- name: Run downloader script
run: |
mkdir -p "${CI_CATALYST_BIN_DIR}/" "releases/"
go run cmd/downloader/downloader.go \
--platform "${{ matrix.platform }}" \
--architecture "${{ matrix.architecture }}" \
--path "./${CI_CATALYST_BIN_DIR}/" \
--manifest "manifest.yaml" \
--v 9
- name: Set build environment
run: |
echo "GOARCH=${{ matrix.architecture }}" >> $GITHUB_ENV
echo "GOOS=${{ matrix.platform }}" >> $GITHUB_ENV
- name: Build binaries
run: |
go build \
-o "./${CI_CATALYST_BIN_DIR}/livepeer-catalyst" \
-ldflags="-X 'main.Version=${{ github.ref_type == 'tag' && github.ref_name || github.event.pull_request.head.sha || github.sha }}'" \
cmd/catalyst/catalyst.go
cp ./scripts/livepeer-vmagent ./bin/livepeer-vmagent
- name: Download c2patool
run: |
curl "https://build.livepeer.live/c2patool/0.6.2/c2patool-${{ matrix.platform }}-${{ matrix.architecture }}.tar.gz" -o c2patool.tar.gz
tar -xvzf c2patool.tar.gz -C ./bin/
- name: Archive binaries for linux/macos
if: matrix.platform != 'windows'
run: |
cd "${CI_CATALYST_BIN_DIR}/"
tar -cvzf "../releases/livepeer-catalyst-${GOOS}-${GOARCH}.tar.gz" *
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: releases/
upload:
name: Upload artifacts to google bucket
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: release-artifacts
path: releases/
- name: Generate sha256 checksum and gpg signatures for release artifacts
uses: livepeer/action-gh-checksum-and-gpg-sign@latest
with:
artifacts-dir: releases
release-name: ${{ (github.ref_type == 'tag' && github.ref_name) || github.event.pull_request.head.sha || github.sha }}
gpg-key: ${{ secrets.CI_GPG_SIGNING_KEY }}
gpg-key-passphrase: ${{ secrets.CI_GPG_SIGNING_PASSPHRASE }}
- name: Generate branch manifest
id: branch-manifest
uses: livepeer/branch-manifest-action@latest
with:
project-name: ${{ github.event.repository.name }}
platform: linux
architecture: amd64
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.CI_GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.CI_GOOGLE_SERVICE_ACCOUNT }}
- name: Upload release archives to Google Cloud
id: upload-archives
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "releases"
destination: "build.livepeer.live/${{ github.event.repository.name }}/${{ (github.ref_type == 'tag' && github.ref_name) || github.event.pull_request.head.sha || github.sha }}"
parent: false
- name: Upload branch manifest file
id: upload-manifest
uses: google-github-actions/upload-cloud-storage@v1
with:
path: ${{ steps.branch-manifest.outputs.manifest-file }}
destination: "build.livepeer.live/${{ github.event.repository.name }}/"
parent: false
- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev