Skip to content

Commit 4d53a16

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

File tree

3 files changed

+375
-123
lines changed

3 files changed

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

0 commit comments

Comments
 (0)