1
- name : Docker
1
+ name : Docker and Release
2
2
on :
3
3
push :
4
4
branches :
5
5
- lyra
6
6
tags :
7
7
- " v*"
8
-
9
8
jobs :
10
9
build :
11
10
continue-on-error : true
12
-
13
11
strategy :
14
12
matrix :
15
13
include :
16
14
- release_for : Linux-x86_64
17
15
build_on : ubuntu-latest
18
16
target : x86_64-unknown-linux-gnu
19
17
args : " --locked --release"
20
-
21
18
# - release_for: Linux-arm64
22
19
# build_on: buildjet-2vcpu-ubuntu-2204-arm
23
20
# target: "aarch64-unknown-linux-gnu"
24
21
# args: "--locked --release"
25
-
26
22
runs-on : ${{ matrix.build_on }}
27
-
28
23
steps :
29
24
- name : checkout repository
30
25
uses : actions/checkout@v4
31
-
32
26
- uses : Swatinem/rust-cache@v2
33
27
with :
34
28
shared-key : " release"
35
-
36
29
- name : Install stable toolchain
37
30
uses : actions-rs/toolchain@v1
38
31
with :
39
32
toolchain : stable
40
-
41
33
- name : Run cargo build
42
34
uses : actions-rs/cargo@v1
43
35
with :
44
36
command : build
45
37
args : --target ${{ matrix.target }} ${{ matrix.args }}
46
-
47
38
- name : rename binaries
48
39
run : |
49
40
mv target/${{ matrix.target }}/release/dolos${{ matrix.ext }} dolos-${{ matrix.release_for }}${{ matrix.ext }}
50
-
51
41
- name : upload artifacts
52
42
uses : actions/upload-artifact@v4
53
43
with :
@@ -57,21 +47,16 @@ jobs:
57
47
docker :
58
48
runs-on : ubuntu-latest
59
49
needs : [build]
60
-
61
50
permissions :
62
51
contents : read
63
52
packages : write
64
-
65
53
env :
66
54
IMAGE : us-central1-docker.pkg.dev/comet-7aaf0/comet-ar/dolos
67
-
68
55
steps :
69
56
- name : Checkout repository
70
57
uses : actions/checkout@v4
71
-
72
58
- name : Set up Docker Buildx
73
59
uses : docker/setup-buildx-action@v3
74
-
75
60
- name : Extract metadata (tags, labels) for Docker
76
61
id : meta
77
62
uses : docker/metadata-action@v5
@@ -83,28 +68,21 @@ jobs:
83
68
type=semver,pattern=v{{major}}.{{minor}}
84
69
type=semver,pattern=v{{version}}
85
70
type=sha
86
-
87
71
- name : Login to DockerHub
88
72
uses : docker/login-action@v3
89
73
with :
90
74
registry : us-central1-docker.pkg.dev
91
75
username : _json_key
92
76
password : ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
93
-
94
77
- name : Download artifacts
95
78
uses : actions/download-artifact@v4
96
79
with :
97
80
pattern : binaries-*
98
81
merge-multiple : true
99
82
path : .github/image/bin
100
-
101
- # we need to rename the artifact so that the name matches
102
- # the value that Docker uses for TARGET_ARCH to keep the
103
- # Dockerfile simple
104
83
- name : Rename artifacts
105
84
run : |+
106
85
mv .github/image/bin/dolos-Linux-x86_64 .github/image/bin/dolos-Linux-amd64
107
-
108
86
- name : Build and push
109
87
uses : docker/build-push-action@v5
110
88
with :
@@ -113,3 +91,25 @@ jobs:
113
91
push : true
114
92
tags : ${{ steps.meta.outputs.tags }}
115
93
labels : ${{ steps.meta.outputs.labels }}
94
+
95
+ release :
96
+ needs : [build]
97
+ if : startsWith(github.ref, 'refs/tags/v')
98
+ runs-on : ubuntu-latest
99
+ permissions :
100
+ contents : write
101
+ steps :
102
+ - name : Download artifacts
103
+ uses : actions/download-artifact@v4
104
+ with :
105
+ pattern : binaries-*
106
+ merge-multiple : true
107
+ path : release-binaries
108
+
109
+ - name : Create Release
110
+ uses : softprops/action-gh-release@v1
111
+ with :
112
+ files : release-binaries/*
113
+ draft : false
114
+ prerelease : false
115
+ generate_release_notes : true
0 commit comments