Skip to content

Commit 09d3215

Browse files
author
iHsin
committed
ci: improve binary release workflow
1 parent 914f6cb commit 09d3215

File tree

3 files changed

+414
-122
lines changed

3 files changed

+414
-122
lines changed
+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: binary-release
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
env:
13+
PACKAGE: "tuic-server"
14+
PACKAGE2: "tuic-client"
15+
16+
jobs:
17+
compile:
18+
name: Compile
19+
permissions:
20+
contents: write
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
include:
25+
# Linux
26+
- os: ubuntu-latest
27+
target: x86_64-unknown-linux-gnu
28+
release-name: x86_64-linux
29+
cross: true
30+
file-ext: ""
31+
extra-args: ""
32+
- os: ubuntu-latest
33+
target: x86_64-unknown-linux-musl
34+
release-name: x86_64-linux-musl
35+
cross: true
36+
file-ext: ""
37+
extra-args: ""
38+
- os: ubuntu-latest
39+
target: i686-unknown-linux-gnu
40+
release-name: i686-linux
41+
cross: true
42+
file-ext: ""
43+
extra-args: ""
44+
- os: ubuntu-latest
45+
target: i686-unknown-linux-musl
46+
release-name: i686-linux-musl
47+
cross: true
48+
file-ext: ""
49+
extra-args: ""
50+
# Linux arm
51+
- os: ubuntu-latest
52+
target: aarch64-unknown-linux-gnu
53+
release-name: aarch64-linux
54+
cross: true
55+
file-ext: ""
56+
extra-args: ""
57+
- os: ubuntu-latest
58+
target: aarch64-unknown-linux-musl
59+
release-name: aarch64-linux-musl
60+
cross: true
61+
file-ext: ""
62+
extra-args: ""
63+
- os: ubuntu-latest
64+
target: armv7-unknown-linux-gnueabi
65+
release-name: armv7-linux
66+
cross: true
67+
file-ext: ""
68+
extra-args: ""
69+
- os: ubuntu-latest
70+
target: armv7-unknown-linux-gnueabihf
71+
release-name: armv7-linux-hf
72+
cross: true
73+
file-ext: ""
74+
extra-args: ""
75+
- os: ubuntu-latest
76+
target: armv7-unknown-linux-musleabi
77+
release-name: armv7-linux-musl
78+
cross: true
79+
file-ext: ""
80+
extra-args: ""
81+
- os: ubuntu-latest
82+
target: armv7-unknown-linux-musleabihf
83+
release-name: armv7-linux-muslhf
84+
cross: true
85+
file-ext: ""
86+
extra-args: ""
87+
88+
# Windows
89+
- os: windows-latest
90+
target: x86_64-pc-windows-msvc
91+
release-name: x86_64-windows
92+
cross: false
93+
file-ext: ".exe"
94+
extra-args: ""
95+
- os: windows-latest
96+
target: i686-pc-windows-msvc
97+
release-name: i686-windows
98+
cross: true
99+
file-ext: ".exe"
100+
extra-args: ""
101+
- os: ubuntu-latest
102+
target: x86_64-pc-windows-gnu
103+
release-name: x86_64-windows-gnu
104+
cross: true
105+
file-ext: ".exe"
106+
extra-args: ""
107+
108+
# MacOSX
109+
- os: macos-latest
110+
target: x86_64-apple-darwin
111+
release-name: x86_64-darwin
112+
cross: false
113+
file-ext: ""
114+
extra-args: ""
115+
- os: macos-latest
116+
target: aarch64-apple-darwin
117+
release-name: aarch64-darwin
118+
cross: true
119+
file-ext: ""
120+
extra-args: ""
121+
122+
# FreeBSD
123+
- os: ubuntu-latest
124+
target: x86_64-unknown-freebsd
125+
release-name: x86_64-freebsd
126+
cross: true
127+
file-ext: ""
128+
extra-args: ""
129+
130+
131+
steps:
132+
- uses: actions/checkout@v2
133+
with:
134+
submodules: recursive
135+
136+
- uses: actions/cache@v2
137+
with:
138+
path: |
139+
~/.cargo/registry
140+
~/.cargo/git
141+
key: ${{ matrix.target }}-release-${{ hashFiles('**/Cargo.toml') }}
142+
restore-keys: |
143+
${{ matrix.target }}-release
144+
145+
- uses: dtolnay/rust-toolchain@master
146+
with:
147+
toolchain: nightly
148+
target: ${{ matrix.target }}
149+
150+
# Build client and server separately
151+
# But i gotta say that's ugly
152+
# Blame me that can't figure out how GHA matrix works
153+
- uses: actions-rs/cargo@v1
154+
with:
155+
use-cross: ${{ matrix.cross }}
156+
command: build
157+
args: --release -p ${{ env.PACKAGE }} --target ${{ matrix.target }} ${{ matrix.extra-args }}
158+
159+
- name: Rename binary
160+
run: mv target/${{ matrix.target }}/release/${{ env.PACKAGE }}${{ matrix.file-ext }} ${{ env.PACKAGE }}-${{ matrix.release-name }}${{ matrix.file-ext }}
161+
162+
- name: Upload binaries
163+
uses: actions/upload-artifact@v2
164+
with:
165+
name: compile
166+
path: ${{ env.PACKAGE }}-${{ matrix.release-name }}${{ matrix.file-ext }}
167+
168+
- uses: actions-rs/cargo@v1
169+
with:
170+
use-cross: ${{ matrix.cross }}
171+
command: build
172+
args: --release -p ${{ env.PACKAGE2 }} --target ${{ matrix.target }} ${{ matrix.extra-args }}
173+
174+
- name: Rename binary
175+
run: mv target/${{ matrix.target }}/release/${{ env.PACKAGE2 }}${{ matrix.file-ext }} ${{ env.PACKAGE2 }}-${{ matrix.release-name }}${{ matrix.file-ext }}
176+
177+
- name: Upload binaries
178+
uses: actions/upload-artifact@v2
179+
with:
180+
name: compile
181+
path: ${{ env.PACKAGE2 }}-${{ matrix.release-name }}${{ matrix.file-ext }}
182+
183+
release:
184+
name: Release
185+
needs: [compile]
186+
runs-on: ubuntu-latest
187+
steps:
188+
- uses: actions/checkout@v2
189+
with:
190+
submodules: recursive
191+
192+
- name: Download binaries
193+
uses: actions/download-artifact@v2
194+
with:
195+
name: compile
196+
path: ./packages
197+
198+
- name: Github release
199+
uses: "marvinpinto/action-automatic-releases@latest"
200+
with:
201+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
202+
automatic_release_tag: latest
203+
prerelease: true
204+
title: "Bleeding edge/前沿版本"
205+
files: |
206+
packages/*
207+
LICENSE

0 commit comments

Comments
 (0)