4
4
release :
5
5
types : [published]
6
6
7
+ pull_request :
8
+ branches :
9
+ - master
10
+
11
+ concurrency :
12
+ group : release-${{ github.ref }}
13
+ cancel-in-progress : true
14
+
7
15
jobs :
8
16
build-release :
9
17
runs-on : ${{ matrix.operating-system }}
10
18
strategy :
11
19
matrix :
12
- operating-system : [ubuntu-latest, windows-latest, macos-latest]
20
+ include :
21
+ - operating-system : ubuntu-20.04
22
+ targets : x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-gnu,aarch64-unknown-linux-musl
23
+ - operating-system : windows-2019
24
+ targets : aarch64-pc-windows-msvc,x86_64-pc-windows-msvc
25
+ - operating-system : macos-12
26
+ targets : aarch64-apple-darwin,x86_64-apple-darwin
27
+ fail-fast : false
13
28
steps :
14
- - uses : actions/checkout@v2
29
+ - uses : actions/checkout@v4
30
+
15
31
- name : Install stable Rust toolchain
16
- uses : actions-rs/ toolchain@v1
32
+ uses : dtolnay/rust- toolchain@stable
17
33
with :
18
- profile : minimal
19
34
toolchain : stable
20
- override : true
21
- target : aarch64-apple-darwin
35
+ targets : ${{ matrix.targets }}
36
+
37
+ - name : Rust caching
38
+ uses : Swatinem/rust-cache@v2
39
+ with :
40
+ workspaces : rust
41
+
42
+ - name : Set up QEMU
43
+ if : runner.os == 'Linux'
44
+ uses : docker/setup-qemu-action@v3
45
+
46
+ - name : Set up Docker Buildx
47
+ if : runner.os == 'Linux'
48
+ uses : docker/setup-buildx-action@v3
49
+
50
+ - name : Cargo flags
51
+ id : cargo-flags
52
+ shell : bash
53
+ run : |
54
+ if [[ "${{ github.event_name }}" = "release" ]]; then
55
+ echo "flags=--release" >> "$GITHUB_OUTPUT"
56
+ else
57
+ echo "flags=" >> "$GITHUB_OUTPUT"
58
+ fi
59
+
22
60
- name : Install LLVM
23
61
run : choco install -y llvm
24
62
if : runner.os == 'Windows'
25
- - if : runner.os == 'Linux'
26
- run : ./scripts/release-linux.sh
27
- - if : runner.os == 'Windows'
28
- run : ./scripts/release-win.sh
29
- shell : bash
30
- - if : runner.os == 'macOS'
31
- run : ./scripts/release-osx.sh
63
+
64
+ - name : build and release ${{ runner.os }}
65
+ run : ./release.sh ${{ runner.os }} ${{ steps.cargo-flags.outputs.flags }}
32
66
shell : bash
67
+
33
68
- name : Upload Release Assets
69
+ if : |
70
+ startsWith(github.ref, 'refs/tags/v')
34
71
id : upload-release-asset
35
72
uses : svenstaro/upload-release-action@v2
36
73
with :
37
74
repo_token : ${{ secrets.GITHUB_TOKEN }}
38
75
file : release_artifacts/*
39
76
file_glob : true
40
77
tag : ${{ github.ref }}
78
+
79
+ release_docker :
80
+ runs-on : ubuntu-latest
81
+ needs : build-release
82
+ if : |
83
+ startsWith(github.ref, 'refs/tags/v')
84
+
85
+ steps :
86
+ - uses : actions/checkout@v3
87
+ with :
88
+ fetch-depth : 0
89
+
90
+ - name : Log into ghcr registry
91
+ uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
92
+ with :
93
+ registry : ghcr.io
94
+ username : ${{ github.actor }}
95
+ password : ${{ secrets.GITHUB_TOKEN }}
96
+
97
+ - name : Log into docker registry
98
+ uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
99
+ with :
100
+ username : ${{ secrets.DOCKER_HUB_USERNAME }}
101
+ password : ${{ secrets.DOCKER_HUB_TOKEN }}
102
+
103
+ - name : Set up QEMU
104
+ uses : docker/setup-qemu-action@v3
105
+
106
+ - name : push_image
107
+ id : cargo-flags
108
+ shell : bash
109
+ run : |
110
+ if [[ "${{ github.event_name }}" = "release" ]]; then
111
+ echo "PUSH_IMAGE=true" >> "$GITHUB_ENV"
112
+ fi
113
+
114
+ - name : Release image
115
+ run : cd docker && hooks/build
116
+ env :
117
+ DOCKER_TAG : ${{ github.ref }}
118
+ PUSH_IMAGE : ${{ env.PUSH_IMAGE }}
0 commit comments