-
Notifications
You must be signed in to change notification settings - Fork 23
145 lines (145 loc) · 6.69 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
name: publish release
on:
create:
tags:
- 'v*'
branches-ignore:
- '*'
push:
branches:
- workflow
jobs:
build:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
arch:
- x86_64
- aarch64
exclude:
- os: windows-latest
arch: aarch64
steps:
-
uses: actions/checkout@v4
-
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: '${{ runner.os }}-cargo-${{ hashFiles(''**/Cargo.lock'') }}'
-
name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y protobuf-compiler libprotobuf-dev gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
which cargo-zigbuild || cargo install cargo-zigbuild
sudo snap install zig --classic --beta
-
name: Install dependencies (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
run: |
mkdir third_party;
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-win64.zip -OutFile ./third_party/protoc-25.1-win64.zip;
Expand-Archive -Path ./third_party/protoc-25.1-win64.zip -DestinationPath ./third_party;
-
name: Build release (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
run: |
$env:PROTOC = "${{ github.workspace }}/third_party/bin/protoc.exe";
cargo build --release;
-
name: Build release (Linux)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
run: cargo build --release
-
name: Build release (Linux aarch64)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
run: cargo zigbuild --target aarch64-unknown-linux-gnu --release
-
name: Rename release (Linux)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
run: |
mv ./target/release/turn-balance-server ./target/release/turn-balance-server-linux-x86_64
mv ./target/release/turn-server ./target/release/turn-server-linux-x86_64
mv ./target/release/turn-cli ./target/release/turn-cli-linux-x86_64
-
name: Rename release (Linux)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
run: |
mv ./target/aarch64-unknown-linux-gnu/release/turn-balance-server ./target/aarch64-unknown-linux-gnu/release/turn-balance-server-linux-aarch64
mv ./target/aarch64-unknown-linux-gnu/release/turn-server ./target/aarch64-unknown-linux-gnu/release/turn-server-linux-aarch64
mv ./target/aarch64-unknown-linux-gnu/release/turn-cli ./target/aarch64-unknown-linux-gnu/release/turn-cli-linux-aarch64
-
name: Rename release (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
run: |
Remove-Item -Path "./target/release/turn-balance-server-windows-x86_64.exe" -ErrorAction SilentlyContinue;
Remove-Item -Path "./target/release/turn-server-windows-x86_64.exe" -ErrorAction SilentlyContinue;
Remove-Item -Path "./target/release/turn-cli-windows-x86_64.exe" -ErrorAction SilentlyContinue;
Rename-Item -Path "./target/release/turn-balance-server.exe" -NewName "turn-balance-server-windows-x86_64.exe";
Rename-Item -Path "./target/release/turn-server.exe" -NewName "turn-server-windows-x86_64.exe";
Rename-Item -Path "./target/release/turn-cli.exe" -NewName "turn-cli-windows-x86_64.exe";
-
name: Upload artifact (Linux)
if: runner.os == 'Linux' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v3
with:
name: linux-x86_64
path: |
./target/release/turn-balance-server-linux-x86_64
./target/release/turn-server-linux-x86_64
./target/release/turn-cli-linux-x86_64
-
name: Upload artifact (Linux)
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
uses: actions/upload-artifact@v3
with:
name: linux-x86_64
path: |
./target/aarch64-unknown-linux-gnu/release/turn-balance-server-linux-aarch64
./target/aarch64-unknown-linux-gnu/release/turn-server-linux-aarch64
./target/aarch64-unknown-linux-gnu/release/turn-cli-linux-aarch64
-
name: Upload artifact (Windows)
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
uses: actions/upload-artifact@v3
with:
name: windows-x86_64
path: |
./target/release/turn-balance-server-windows-x86_64.exe
./target/release/turn-server-windows-x86_64.exe
./target/release/turn-cli-windows-x86_64.exe
deploy:
needs: build
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v3
-
name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
-
name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: false
files: artifacts/**/*