@@ -14,31 +14,52 @@ jobs:
14
14
strategy :
15
15
matrix :
16
16
target :
17
- [
18
- x86_64-unknown-linux -gnu,
19
- x86_64-pc-windows-gnu,
20
- x86_64 -apple-darwin,
21
- aarch64-apple-darwin,
22
- ]
23
- name : [commit-boost-cli, commit-boost-pbs, commit-boost-signer]
24
-
17
+ - x86_64-unknown-linux-gnu
18
+ - x86_64-pc-windows -gnu
19
+ # - x86_64-apple-darwin
20
+ - aarch64 -apple-darwin
21
+ name :
22
+ - commit-boost-cli
23
+ - commit-boost-pbs
24
+ - commit-boost-signer
25
25
include :
26
26
- target : x86_64-unknown-linux-gnu
27
27
os : ubuntu-latest
28
28
- target : x86_64-pc-windows-gnu
29
29
os : windows-latest
30
- - target : x86_64-apple-darwin
31
- os : macos-latest
30
+ # - target: x86_64-apple-darwin
31
+ # os: macos-latest
32
32
- target : aarch64-apple-darwin
33
33
os : macos-latest
34
-
35
34
runs-on : ${{ matrix.os }}
36
35
steps :
37
36
- name : Checkout code
38
37
uses : actions/checkout@v4
39
38
with :
40
39
ref : " stable"
41
40
41
+ - name : Cache Cargo registry
42
+ uses : actions/cache@v3
43
+ with :
44
+ path : ~/.cargo/registry
45
+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
46
+
47
+ - name : Cache Cargo index
48
+ uses : actions/cache@v3
49
+ with :
50
+ path : ~/.cargo/git
51
+ key : ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
52
+
53
+ - name : Cache Cargo build
54
+ uses : actions/cache@v3
55
+ with :
56
+ path : target
57
+ key : ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
58
+ restore-keys : |
59
+ ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ matrix.name }}-
60
+ ${{ runner.os }}-cargo-build-${{ matrix.target }}-
61
+ ${{ runner.os }}-cargo-build-
62
+
42
63
- name : Install GNU toolchain (Windows)
43
64
if : matrix.target == 'x86_64-pc-windows-gnu'
44
65
uses : msys2/setup-msys2@v2
56
77
target : ${{ matrix.target }}
57
78
58
79
- name : Build binary
59
- uses : actions-rs/cargo@v1
60
- with :
61
- command : build
62
- args : --release --target ${{ matrix.target }} --bin ${{ matrix.name }}
80
+ run : cargo build --release --target ${{ matrix.target }} --bin ${{ matrix.name }}
63
81
env :
64
82
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER : gcc
65
83
@@ -73,18 +91,16 @@ jobs:
73
91
- name : Package binary (Windows)
74
92
if : runner.os == 'Windows'
75
93
run : |
76
- cd target/${{ matrix.target }}/release
77
- 7z a ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.zip ${{ matrix.name }}.exe
78
- move ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.zip ../../../
94
+ 7z a ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.zip target\${{ matrix.target }}\release\${{ matrix.name }}.exe
79
95
80
- - name : Upload binary to release
81
- uses : softprops/action-gh-release@v2
96
+ - name : Upload artifact
97
+ uses : actions/upload-artifact@v3
82
98
with :
83
- files : ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.${{ runner.os == 'Windows' && 'zip' || 'tar.gz' }}
84
- draft : true
85
- token : ${{ secrets.GITHUB_TOKEN }}
99
+ name : ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}
100
+ path : |
101
+ ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.${{ runner.os == 'Windows' && 'zip' || 'tar.gz' }}
86
102
87
- build-and-push-docker :
103
+ build-and-push-pbs- docker :
88
104
runs-on : ubuntu-latest
89
105
steps :
90
106
- name : Checkout code
@@ -105,17 +121,6 @@ jobs:
105
121
username : ${{ github.actor }}
106
122
password : ${{ secrets.GITHUB_TOKEN }}
107
123
108
- - name : Prepare Docker metadata
109
- id : meta
110
- uses : docker/metadata-action@v4
111
- with :
112
- images : |
113
- ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}
114
- tags : |
115
- type=semver,pattern={{version}}
116
- type=semver,pattern={{major}}.{{minor}}
117
- type=raw,value=latest,enable={{is_default_branch}}
118
-
119
124
- name : Build and push PBS Docker image
120
125
uses : docker/build-push-action@v6
121
126
with :
@@ -125,10 +130,31 @@ jobs:
125
130
tags : |
126
131
ghcr.io/commit-boost/pbs:${{ github.ref_name }}
127
132
ghcr.io/commit-boost/pbs:latest
128
- cache-from : type=gha
129
- cache-to : type=gha ,mode=max
133
+ cache-from : type=registry,ref=ghcr.io/commit-boost/pbs:buildcache
134
+ cache-to : type=registry,ref=ghcr.io/commit-boost/pbs:buildcache ,mode=max
130
135
file : docker/pbs.Dockerfile
131
136
137
+ build-and-push-signer-docker :
138
+ runs-on : ubuntu-latest
139
+ steps :
140
+ - name : Checkout code
141
+ uses : actions/checkout@v4
142
+ with :
143
+ ref : " stable"
144
+
145
+ - name : Set up QEMU
146
+ uses : docker/setup-qemu-action@v3
147
+
148
+ - name : Set up Docker Buildx
149
+ uses : docker/setup-buildx-action@v3
150
+
151
+ - name : Login to GitHub Container Registry
152
+ uses : docker/login-action@v3
153
+ with :
154
+ registry : ghcr.io
155
+ username : ${{ github.actor }}
156
+ password : ${{ secrets.GITHUB_TOKEN }}
157
+
132
158
- name : Build and push Signer Docker image
133
159
uses : docker/build-push-action@v6
134
160
with :
@@ -138,18 +164,29 @@ jobs:
138
164
tags : |
139
165
ghcr.io/commit-boost/signer:${{ github.ref_name }}
140
166
ghcr.io/commit-boost/signer:latest
141
- cache-from : type=gha
142
- cache-to : type=gha ,mode=max
143
- file : docker/pbs .Dockerfile
167
+ cache-from : type=registry,ref=ghcr.io/commit-boost/signer:buildcache
168
+ cache-to : type=registry,ref=ghcr.io/commit-boost/signer:buildcache ,mode=max
169
+ file : docker/signer .Dockerfile
144
170
145
171
finalize-release :
146
- needs : [build-binaries, build-and-push-docker]
172
+ needs :
173
+ - build-binaries
174
+ - build-and-push-pbs-docker
175
+ - build-and-push-signer-docker
147
176
runs-on : ubuntu-latest
148
177
steps :
178
+ - name : Download artifacts
179
+ uses : actions/download-artifact@v3
180
+ with :
181
+ path : ./artifacts
182
+
149
183
- name : Finalize Release
150
184
uses : softprops/action-gh-release@v2
151
185
with :
152
- name : ${{ github.ref_name }}
153
- tag_name : ${{ github.ref_name }}
186
+ files : ./artifacts/**/*
154
187
draft : true
155
188
prerelease : false
189
+ tag_name : ${{ github.ref_name }}
190
+ name : ${{ github.ref_name }}
191
+ env :
192
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments