-
-
Notifications
You must be signed in to change notification settings - Fork 300
97 lines (86 loc) · 2.97 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
name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
release:
name: Cross build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install cross
run: cargo install cross
- name: Run tests
run: cross test --release --target ${{ matrix.target }} --verbose
- name: Build release
run: cross build --release --target ${{ matrix.target }}
- name: Install LLVM Strip
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y llvm
- name: LLVM Strip
if: matrix.os == 'ubuntu-latest'
continue-on-error: true
run: |
llvm-strip target/${{ matrix.target }}/release/stat_server
llvm-strip target/${{ matrix.target }}/release/stat_client
cp config.toml target/${{ matrix.target }}/release/
cp docker-compose.yml target/${{ matrix.target }}/release/
cp systemd/stat_server.service target/${{ matrix.target }}/release/
cp systemd/stat_client.service target/${{ matrix.target }}/release/
- name: Run UPX
# Upx may not support some platforms. Ignore the errors
continue-on-error: true
# Disable upx for mips. See https://github.com/upx/upx/issues/387
if: matrix.os == 'ubuntu-latest' && !contains(matrix.target, 'mips')
uses: crazy-max/ghaction-upx@v1
with:
version: latest
files: |
target/${{ matrix.target }}/release/stat_server
target/${{ matrix.target }}/release/stat_client
args: -q --best --lzma
- uses: actions/upload-artifact@v3
with:
name: ServerStatus-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/stat_server
target/${{ matrix.target }}/release/stat_client
target/${{ matrix.target }}/release/config.toml
target/${{ matrix.target }}/release/docker-compose.yml
target/${{ matrix.target }}/release/stat_server.service
target/${{ matrix.target }}/release/stat_client.service
- name: Zip Release
uses: TheDoctor0/zip-release@0.6.1
with:
type: zip
filename: ServerStatus-${{ matrix.target }}.zip
directory: target/${{ matrix.target }}/release/
path: |
stat_server
stat_client
config.toml
stat_server.service
stat_client.service
docker-compose.yml
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/${{ matrix.target }}/release/ServerStatus-${{ matrix.target }}.zip
generate_release_notes: true
draft: true