@@ -10,24 +10,99 @@ permissions:
10
10
packages : write
11
11
12
12
jobs :
13
- build-binaries :
13
+ # Builds the x64 and arm64 binaries for Linux, for all 3 crates, via the Docker builder
14
+ build-binaries-linux :
14
15
strategy :
15
16
matrix :
16
17
target :
17
- - x86_64-unknown-linux-gnu
18
+ - amd64
19
+ - arm64
20
+ name :
21
+ - commit-boost-cli
22
+ - commit-boost-pbs
23
+ - commit-boost-signer
24
+ include :
25
+ - target : amd64
26
+ package-suffix : x86-64
27
+ - target : arm64
28
+ package-suffix : arm64
29
+ - name : commit-boost-cli
30
+ target-crate : cli
31
+ - name : commit-boost-pbs
32
+ target-crate : pbs
33
+ - name : commit-boost-signer
34
+ target-crate : signer
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - name : Checkout code
38
+ uses : actions/checkout@v4
39
+ with :
40
+ ref : " stable"
41
+ fetch-depth : 0
42
+ submodules : true
43
+
44
+ - name : Log commit hash
45
+ run : |
46
+ echo "Releasing commit: $(git rev-parse HEAD)"
47
+
48
+ - name : Set up QEMU
49
+ uses : docker/setup-qemu-action@v3
50
+
51
+ - name : Set up Docker Buildx
52
+ uses : docker/setup-buildx-action@v3
53
+
54
+ - name : Login to GitHub Container Registry
55
+ uses : docker/login-action@v3
56
+ with :
57
+ registry : ghcr.io
58
+ username : ${{ github.actor }}
59
+ password : ${{ secrets.GITHUB_TOKEN }}
60
+
61
+ - name : Build binary (Linux)
62
+ uses : docker/build-push-action@v6
63
+ with :
64
+ context : .
65
+ push : false
66
+ platforms : linux/amd64,linux/arm64
67
+ cache-from : type=registry,ref=ghcr.io/commit-boost/buildcache:${{ matrix.target-crate}}
68
+ cache-to : type=registry,ref=ghcr.io/commit-boost/buildcache:${{ matrix.target-crate }},mode=max
69
+ file : provisioning/build.Dockerfile
70
+ outputs : type=local,dest=build
71
+ build-args : |
72
+ TARGET_CRATE=${{ matrix.name }}
73
+
74
+ - name : Package binary (Linux)
75
+ run : |
76
+ cd build/linux_${{ matrix.target }}
77
+ tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz ${{ matrix.name }}
78
+ mv ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz ../../
79
+
80
+ - name : Upload artifact
81
+ uses : actions/upload-artifact@v4
82
+ with :
83
+ name : ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}
84
+ path : |
85
+ ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz
86
+
87
+ # Builds the arm64 binaries for Darwin, for all 3 crates, natively
88
+ build-binaries-darwin :
89
+ strategy :
90
+ matrix :
91
+ target :
92
+ # x64 requires macos-latest-large which is not available in the free tier
18
93
# - x86_64-apple-darwin
19
94
- aarch64-apple-darwin
20
95
name :
21
96
- commit-boost-cli
22
97
- commit-boost-pbs
23
98
- commit-boost-signer
24
99
include :
25
- - target : x86_64-unknown-linux-gnu
26
- os : ubuntu-latest
27
100
# - target: x86_64-apple-darwin
28
- # os: macos-latest
101
+ # os: macos-latest-large
102
+ # package-suffix: x86-64
29
103
- target : aarch64-apple-darwin
30
104
os : macos-latest
105
+ package-suffix : arm64
31
106
runs-on : ${{ matrix.os }}
32
107
steps :
33
108
- name : Checkout code
@@ -41,6 +116,12 @@ jobs:
41
116
run : |
42
117
echo "Releasing commit: $(git rev-parse HEAD)"
43
118
119
+ - name : Install Protoc
120
+ run :
121
+ # Brew's version is much more up to date than the Linux ones, and installing the latest via script runs into curl issues so for now, brew's easier to use
122
+ # provisioning/protoc.sh
123
+ brew install protobuf
124
+
44
125
- name : Cache Cargo registry
45
126
uses : actions/cache@v3
46
127
with :
@@ -63,48 +144,25 @@ jobs:
63
144
${{ runner.os }}-cargo-build-${{ matrix.target }}-
64
145
${{ runner.os }}-cargo-build-
65
146
66
- - name : Install protoc (Ubuntu)
67
- if : runner.os == 'Linux'
68
- run : sudo apt-get install protobuf-compiler
69
-
70
- - name : Install protoc (macOS)
71
- if : runner.os == 'macOS'
72
- run : brew install protobuf
73
-
74
- - name : Set up Rust
75
- uses : actions-rs/toolchain@v1
76
- with :
77
- profile : minimal
78
- toolchain : stable
79
- override : true
80
- target : ${{ matrix.target }}
81
-
82
- - name : Build binary
147
+ - name : Build binary (Darwin)
83
148
run : cargo build --release --target ${{ matrix.target }} --bin ${{ matrix.name }}
84
- env :
85
- CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER : gcc
86
149
87
- - name : Package binary (Unix)
88
- if : runner.os != 'Windows'
150
+ - name : Package binary (Darwin)
89
151
run : |
90
152
cd target/${{ matrix.target }}/release
91
- tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ matrix.name }}
92
- mv ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ../../../
93
-
94
- - name : Package binary (Windows)
95
- if : runner.os == 'Windows'
96
- run : |
97
- 7z a ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.zip target\${{ matrix.target }}\release\${{ matrix.name }}.exe
153
+ tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz ${{ matrix.name }}
154
+ mv ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz ../../../
98
155
99
156
- name : Upload artifact
100
157
uses : actions/upload-artifact@v4
101
158
with :
102
- name : ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}
159
+ name : ${{ matrix.name }}-${{ github.ref_name }}-darwin_ ${{ matrix.package-suffix }}
103
160
path : |
104
- ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.${{ runner.os == 'Windows' && 'zip' || ' tar.gz' }}
161
+ ${{ matrix.name }}-${{ github.ref_name }}-darwin_ ${{ matrix.package-suffix }}.tar.gz
105
162
163
+ # Builds the PBS Docker image
106
164
build-and-push-pbs-docker :
107
- needs : [build-binaries]
165
+ needs : [build-binaries-linux ]
108
166
runs-on : ubuntu-latest
109
167
steps :
110
168
- name : Checkout code
@@ -114,6 +172,20 @@ jobs:
114
172
fetch-depth : 0
115
173
submodules : true
116
174
175
+ - name : Download binary archives
176
+ uses : actions/download-artifact@v4
177
+ with :
178
+ path : ./artifacts
179
+ pattern : " commit-boost-*"
180
+
181
+ - name : Extract binaries
182
+ run : |
183
+ mkdir -p ./artifacts/bin
184
+ tar -xzf ./artifacts/commit-boost-pbs-${{ github.ref_name }}-linux_x86-64/commit-boost-pbs-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
185
+ mv ./artifacts/bin/commit-boost-pbs ./artifacts/bin/commit-boost-pbs-linux-amd64
186
+ tar -xzf ./artifacts/commit-boost-pbs-${{ github.ref_name }}-linux_arm64/commit-boost-pbs-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
187
+ mv ./artifacts/bin/commit-boost-pbs ./artifacts/bin/commit-boost-pbs-linux-arm64
188
+
117
189
- name : Set up QEMU
118
190
uses : docker/setup-qemu-action@v3
119
191
@@ -133,15 +205,16 @@ jobs:
133
205
context : .
134
206
push : true
135
207
platforms : linux/amd64,linux/arm64
208
+ build-args : |
209
+ BINARIES_PATH=./artifacts/bin
136
210
tags : |
137
211
ghcr.io/commit-boost/pbs:${{ github.ref_name }}
138
212
${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/pbs:latest' || '' }}
139
- cache-from : type=registry,ref=ghcr.io/commit-boost/pbs:buildcache
140
- cache-to : type=registry,ref=ghcr.io/commit-boost/pbs:buildcache,mode=max
141
213
file : provisioning/pbs.Dockerfile
142
214
215
+ # Builds the Signer Docker image
143
216
build-and-push-signer-docker :
144
- needs : [build-binaries]
217
+ needs : [build-binaries-linux ]
145
218
runs-on : ubuntu-latest
146
219
steps :
147
220
- name : Checkout code
@@ -151,6 +224,20 @@ jobs:
151
224
fetch-depth : 0
152
225
submodules : true
153
226
227
+ - name : Download binary archives
228
+ uses : actions/download-artifact@v4
229
+ with :
230
+ path : ./artifacts
231
+ pattern : " commit-boost-*"
232
+
233
+ - name : Extract binaries
234
+ run : |
235
+ mkdir -p ./artifacts/bin
236
+ tar -xzf ./artifacts/commit-boost-signer-${{ github.ref_name }}-linux_x86-64/commit-boost-signer-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
237
+ mv ./artifacts/bin/commit-boost-signer ./artifacts/bin/commit-boost-signer-linux-amd64
238
+ tar -xzf ./artifacts/commit-boost-signer-${{ github.ref_name }}-linux_arm64/commit-boost-signer-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
239
+ mv ./artifacts/bin/commit-boost-signer ./artifacts/bin/commit-boost-signer-linux-arm64
240
+
154
241
- name : Set up QEMU
155
242
uses : docker/setup-qemu-action@v3
156
243
@@ -170,16 +257,18 @@ jobs:
170
257
context : .
171
258
push : true
172
259
platforms : linux/amd64,linux/arm64
260
+ build-args : |
261
+ BINARIES_PATH=./artifacts/bin
173
262
tags : |
174
263
ghcr.io/commit-boost/signer:${{ github.ref_name }}
175
264
${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/signer:latest' || '' }}
176
- cache-from : type=registry,ref=ghcr.io/commit-boost/signer:buildcache
177
- cache-to : type=registry,ref=ghcr.io/commit-boost/signer:buildcache,mode=max
178
265
file : provisioning/signer.Dockerfile
179
266
267
+ # Creates a draft release on GitHub with the binaries
180
268
finalize-release :
181
269
needs :
182
- - build-binaries
270
+ - build-binaries-linux
271
+ - build-binaries-darwin
183
272
- build-and-push-pbs-docker
184
273
- build-and-push-signer-docker
185
274
runs-on : ubuntu-latest
0 commit comments