-
Notifications
You must be signed in to change notification settings - Fork 21
181 lines (133 loc) · 5.35 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Release
on:
release:
types: [created]
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
linux-x86-64-dist:
runs-on: ubuntu-20.04
if: startsWith(github.event.release.tag_name, 'v')
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Test
run: cargo test --all --release
- name: Install cargo deb
run: cargo install cargo-deb --version 2.11.1 --force
- name: Install cargo generate rpm
run: cargo install cargo-generate-rpm --version 0.15.2 --force
- name: Make upload directory
run: mkdir upload
- name: Build
run: |
cargo build --release --verbose
cp target/release/tw upload/tw-x86-linux-gnu
zip -r upload/manual.zip target/manual
zip -r upload/complition.zip target/completion
- name: Build .deb package
run: cargo deb --output upload/tabiew-x86_64-linux-gnu.deb
- name: Build .rpm package
run: cargo generate-rpm --output upload/tabiew-x86_64-linux-gnu.rpm
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: "./upload/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
linux-armv7-dist:
runs-on: ubuntu-20.04
if: startsWith(github.event.release.tag_name, 'v')
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Test
run: cargo test --all --release
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential libzstd-dev gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
- name: Install Rust for cross compile
run: rustup target add armv7-unknown-linux-gnueabihf
- name: Install cargo deb
run: cargo install cargo-deb --version 2.11.1 --force
- name: Install cargo generate rpm
run: cargo install cargo-generate-rpm --version 0.15.2 --force
- name: Make upload directory
run: mkdir upload
- name: Build binary, deb, and rpm
run: |
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
cargo build --release --verbose --target armv7-unknown-linux-gnueabihf
cp target/armv7-unknown-linux-gnueabihf/release/tw upload/tw-armv7-linux-gnueabihf
cargo deb --output upload/tabiew-armv7-linux-gnueabihf.deb --target armv7-unknown-linux-gnueabihf
cargo generate-rpm --output upload/tabiew-armv7-linux-gnueabihf.rpm --target armv7-unknown-linux-gnueabihf
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: "./upload/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
linux-aarch64-dist:
runs-on: ubuntu-20.04
if: startsWith(github.event.release.tag_name, 'v')
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Test
run: cargo test --all --release
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential libzstd-dev gcc-aarch64-linux-gnu libc6-dev-arm64-cross
- name: Install Rust cross compile
run: rustup target add aarch64-unknown-linux-gnu
- name: Install cargo deb
run: cargo install cargo-deb --version 2.11.1 --force
- name: Install cargo generate rpm
run: cargo install cargo-generate-rpm --version 0.15.2 --force
- name: Make upload directory
run: mkdir upload
- name: Build binary, deb, and rpm
run: |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
cargo build --release --verbose --target aarch64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/release/tw upload/tw-aarch64-unknown-linux-gnu
cargo deb --output upload/tabiew-aarch64-linux-gnu.deb --target aarch64-unknown-linux-gnu
cargo generate-rpm --output upload/tabiew-aarch64-linux-gnu.rpm --target aarch64-unknown-linux-gnu
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: "./upload/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}
macos-dist:
if: startsWith(github.event.release.tag_name, 'v')
strategy:
matrix:
os: [macos-latest]
target: [aarch64-apple-darwin]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose --target ${{ matrix.target }}
- name: Test
run: cargo test --all --release
- name: Rename before upload
run: mv target/${{ matrix.target }}/release/tw tw-${{matrix.target}}
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: tw-${{matrix.target}}
repo-token: ${{ secrets.GITHUB_TOKEN }}
upload-to-crates-io:
if: startsWith(github.event.release.tag_name, 'v')
runs-on: ubuntu-latest
needs: [linux-x86-64-dist, linux-aarch64-dist, linux-armv7-dist, macos-dist ]
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Remove things to reduce size
run: |
rm -rf tutorial
rm -rf .git
- name: Local install
run: cargo install --path .
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}