-
Notifications
You must be signed in to change notification settings - Fork 15
136 lines (121 loc) · 3.98 KB
/
publish.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
name: Publish
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
name: Publish for ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CARGO: cargo
strategy:
matrix:
name:
- linux-x86-gnu
- linux-x86-musl
- linux-arm-gnu
- linux-arm-musl
- macos-x86
- macos-arm
- macos-universal
- windows-x86
include:
- name: linux-x86-gnu
os: ubuntu-latest
family: linux
arch: x86_64
target: x86_64-unknown-linux-gnu
archiver: tar.gz
asset: hl-linux-x86_64-gnu.tar.gz
- name: linux-x86-musl
os: ubuntu-latest
family: linux
arch: x86_64
target: x86_64-unknown-linux-musl
archiver: tar.gz
asset: hl-linux-x86_64-musl.tar.gz
cross: true
- name: linux-arm-gnu
os: ubuntu-latest
family: linux
arch: aarch64
target: aarch64-unknown-linux-gnu
archiver: tar.gz
asset: hl-linux-arm64-gnu.tar.gz
cross: true
- name: linux-arm-musl
os: ubuntu-latest
family: linux
arch: aarch64
target: aarch64-unknown-linux-musl
archiver: tar.gz
asset: hl-linux-arm64-musl.tar.gz
cross: true
- name: macos-x86
os: macos-latest
family: macos
arch: x86_64
target: x86_64-apple-darwin
archiver: tar.gz
asset: hl-macos-x86_64.tar.gz
- name: macos-arm
os: macos-latest
family: macos
arch: aarch64
target: aarch64-apple-darwin
archiver: tar.gz
asset: hl-macos-arm64.tar.gz
- name: macos-universal
os: macos-latest
family: macos
arch: '{aarch64,x86_64}'
target: '{aarch64,x86_64}-apple-darwin'
archiver: tar.gz
asset: hl-macos.tar.gz
universal: true
- name: windows-x86
os: windows-latest
family: windows
arch: x86_64
target: x86_64-pc-windows-msvc
archiver: 7z
asset: hl-windows.zip
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ''
- name: Install Cross
if: matrix.cross
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
- name: Add Target
if: matrix.cross == false && matrix.target != ''
run: |
rustup target add ${{ matrix.target }}
- name: Build
run: echo ${{ matrix.target }} | xargs -n 1 ${{ env.CARGO }} build --release --locked --verbose --target
- name: Sign
if: matrix.family == 'macos'
run: codesign --force --deep --sign - ./target/${{ matrix.target }}/release/hl
- name: Package using `tar`
if: matrix.archiver == 'tar.gz' && matrix.universal == false
run: tar -C ./target/${{ matrix.target }}/release -cz -f ${{ matrix.asset }} hl
- name: Package using `7z`
if: matrix.archiver == '7z' && matrix.universal == false
run: 7z a ${{ matrix.asset }} .\target\${{ matrix.target }}\release\hl.exe
- name: Make universal binary
if: matrix.family == 'macos' && matrix.universal == true
run: lipo ./target/${{ matrix.target }}/release/hl -create -output ./target/hl
- name: Package universal binary using `tar`
if: matrix.archiver == 'tar.gz' && matrix.universal == true
run: tar -C ./target -cz -f ${{ matrix.asset }} hl
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.asset }}
tag: ${{ github.ref }}