-
Notifications
You must be signed in to change notification settings - Fork 21
147 lines (108 loc) · 3.78 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
name: Release
on:
release:
types: [created]
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
build-and-upload-linux:
runs-on: ubuntu-latest
if: startsWith(github.event.release.tag_name, 'v')
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Test
run: cargo test --all --release
- name: Install cargo deb
run: cargo install cargo-deb --version 2.4.0 --force
- name: Build .deb package
run: cargo deb
- name: Install cargo generate rpm
run: cargo install cargo-generate-rpm --version 0.14.1 --force
- name: Build .rpm package
run: cargo generate-rpm
- name: Rename before upload
run: mv target/release/tw tw-x86-linux-gnu
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: "tw-x86-linux-gnu;./target/debian/*.deb;./target/generate-rpm/*.rpm"
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-and-upload-linux-arm-v6-v7-v8:
if: startsWith(github.event.release.tag_name, 'v')
strategy:
matrix:
os: [ubuntu-latest]
target: [arm-unknown-linux-gnueabihf, armv7-unknown-linux-gnueabihf, aarch64-unknown-linux-gnu]
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.exe tw-${{matrix.target}}.exe
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: tw-${{matrix.target}}.exe
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-and-upload-windows:
if: startsWith(github.event.release.tag_name, 'v')
strategy:
matrix:
os: [windows-latest]
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
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.exe tw-${{matrix.target}}.exe
shell: powershell
- name: Upload artifacts to release
uses: AButler/[email protected]
with:
files: tw-${{matrix.target}}.exe
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-and-upload-macos:
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: [build-and-upload-linux, build-and-upload-macos, build-and-upload-windows]
steps:
- name: Checkout to the latest version
uses: actions/checkout@v4
- name: Local install
run: cargo install --path .
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}