-
Notifications
You must be signed in to change notification settings - Fork 11
238 lines (206 loc) · 6.4 KB
/
release.yml
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: Release
on:
workflow_dispatch:
release:
types: [prereleased]
push:
branches:
- main
- master
- dev*
- feat*
- fix*
- chore*
- test*
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "release/"
- "Cargo.lock"
- ".github/workflows/release.yml"
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "release/"
- "Cargo.lock"
- ".github/workflows/release.yml"
jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- arch-name: x86_64-unknown-linux-gnu
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: true
file-ext:
platform: linux
- arch-name: x86_64-unknown-linux-musl
os: ubuntu-latest
target: x86_64-unknown-linux-musl
cross: true
file-ext:
platform: linux
- arch-name: x86_64-unknown-freebsd
os: ubuntu-latest
target: x86_64-unknown-freebsd
cross: true
file-ext:
platform: freebsd
- arch-name: x86_64-pc-windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
file-ext: .exe
platform: windows
- arch-name: x86_64-pc-windows-gnu
os: ubuntu-latest
target: x86_64-pc-windows-gnu
cross: true
file-ext: .exe
platform: windows
- arch-name: x86_64-apple-darwin
os: macos-latest
target: x86_64-apple-darwin
cross: false
file-ext:
platform: darwin
- arch-name: i686-unknown-linux-gnu
os: ubuntu-latest
target: i686-unknown-linux-gnu
cross: true
file-ext:
platform: linux
- arch-name: i686-unknown-linux-musl
os: ubuntu-latest
target: i686-unknown-linux-musl
cross: true
file-ext:
platform: linux
- arch-name: i686-pc-windows-msvc
os: windows-latest
target: i686-pc-windows-msvc
cross: true
file-ext: .exe
platform: windows
- arch-name: aarch64-unknown-linux-gnu
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
file-ext:
platform: linux
- arch-name: aarch64-unknown-linux-musl
os: ubuntu-latest
target: aarch64-unknown-linux-musl
cross: true
file-ext:
platform: linux
- arch-name: aarch64-pc-windows-msvc
os: windows-latest
target: aarch64-pc-windows-msvc
cross: true
file-ext: .exe
platform: windows
- arch-name: aarch64-apple-darwin
os: macos-latest
target: aarch64-apple-darwin
cross: true
file-ext:
platform: darwin
- arch-name: armv7-unknown-linux-gnueabi
os: ubuntu-latest
target: armv7-unknown-linux-gnueabi
cross: true
file-ext:
platform: linux
- arch-name: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
cross: true
file-ext:
platform: linux
- arch-name: armv7-unknown-linux-musleabi
os: ubuntu-latest
target: armv7-unknown-linux-musleabi
cross: true
file-ext:
platform: linux
- arch-name: armv7-unknown-linux-musleabihf
os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
cross: true
file-ext:
platform: linux
- arch-name: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
cross: true
file-ext:
platform: linux
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --target ${{ matrix.target }}
- name: Move binaries
run: |
mkdir artifacts/
mv target/${{ matrix.target }}/release/asport-client${{ matrix.file-ext }} artifacts/
mv target/${{ matrix.target }}/release/asport-server${{ matrix.file-ext }} artifacts/
- name: Prepare package
run: cp *.example.toml artifacts/
- name: Add systemd service for Linux
if: matrix.platform == 'linux'
run: cp -r release/systemd artifacts/
- name: Archive artifacts
id: archive
shell: bash
run: |
pushd artifacts
if ${{ matrix.platform == 'windows' }}; then
7z a ../asport-${{ matrix.arch-name }}.zip .
FILE=asport-${{ matrix.arch-name }}.zip
else
tar -cJf ../asport-${{ matrix.arch-name }}.tar.xz .
FILE=asport-${{ matrix.arch-name }}.tar.xz
fi
popd
echo "FILE=$FILE" >> $GITHUB_OUTPUT
- name: Calculate digest
shell: bash
run: |
DGST=${{ steps.archive.outputs.FILE }}.dgst
openssl dgst -md5 $FILE | sed 's/([^)]*)//g' >>$DGST
openssl dgst -sha1 $FILE | sed 's/([^)]*)//g' >>$DGST
openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >>$DGST
openssl dgst -sha512 $FILE | sed 's/([^)]*)//g' >>$DGST
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: asport-${{ matrix.arch-name }}
path: asport-${{ matrix.arch-name }}.*
- name: Upload to GitHub release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
asport-${{ matrix.arch-name }}.*
file_glob: true