-
Notifications
You must be signed in to change notification settings - Fork 4
181 lines (159 loc) · 5.34 KB
/
release.yaml
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: Publish release binaries
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
test:
description: 'Testing the release workflow'
required: true
default: 'true'
jobs:
build:
name: Publish for ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, armv7, arm64, windows, macos]
include:
- name: linux
os: ubuntu-22.04
build_deps: >
archive_name: dee.tar.gz
asset_suffix: x86_64-linux.tar.gz
- name: armv7
os: ubuntu-22.04
target: armv7-unknown-linux-gnueabihf
build_deps: >
gcc-arm-linux-gnueabihf
cargo_config: |
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
build_flags: --target armv7-unknown-linux-gnueabihf
archive_name: dee.tar.gz
asset_suffix: armv7-linux.tar.gz
- name: arm64
os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
build_deps: >
gcc-aarch64-linux-gnu
cargo_config: |
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
build_flags: --target aarch64-unknown-linux-gnu
archive_name: dee.tar.gz
asset_suffix: arm64-linux.tar.gz
- name: windows
os: windows-latest
archive_name: dee.zip
asset_suffix: x86_64-windows.zip
- name: macos
os: macos-latest
archive_name: dee.tar.gz
asset_suffix: x86_64-darwin.tar.gz
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Add target
run: rustup target add ${{ matrix.target }}
if: matrix.target != ''
- name: Install linux build dependencies
run: sudo apt update && sudo apt install ${{ matrix.build_deps }}
if: matrix.build_deps != ''
- name: Set up .cargo/config
run: |
mkdir .cargo
echo '${{ matrix.cargo_config }}' >.cargo/config
if: matrix.cargo_config != ''
- name: cargo build
run: cargo build --release --locked ${{ matrix.build_flags }}
working-directory: ./dee
- name: Create archive
run: |
mkdir -p release/dee
mv target/${{ matrix.target }}/release/dee* release/dee/
rm release/dee/*.d
tar czf ${{ matrix.archive_name }} -C release/ dee/
if: matrix.name != 'windows'
- name: Create archive [Windows]
run: |
mkdir -p release/dee
mv target/release/dee.exe release/dee/
cd release/
7z.exe a ../${{ matrix.archive_name }} dee/
shell: bash
if: matrix.name == 'windows'
- name: Upload archive to release
uses: svenstaro/upload-release-action@2.5.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.archive_name }}
asset_name: dee-$tag-${{ matrix.asset_suffix }}
tag: ${{ github.ref }}
prerelease: true
if: github.event.inputs.test != 'true'
deb:
name: Debian ${{ matrix.name }}
runs-on: ubuntu-22.04
strategy:
matrix:
name: [linux, armv7, arm64]
include:
- name: linux
target: x86_64-unknown-linux-gnu
- name: armv7
target: armv7-unknown-linux-gnueabihf
build_deps: >
gcc-arm-linux-gnueabihf
cargo_config: |
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
- name: arm64
target: aarch64-unknown-linux-gnu
build_deps: >
gcc-aarch64-linux-gnu
cargo_config: |
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: cargo install cargo-deb
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-deb
- name: Install build dependencies
run: sudo apt update && sudo apt install ${{ matrix.build_deps }}
if: matrix.build_deps != ''
- name: Set up .cargo/config
run: |
mkdir .cargo
echo '${{ matrix.cargo_config }}' >.cargo/config
if: matrix.cargo_config != ''
- name: cargo build
run: cargo build --release --locked --target ${{ matrix.target }} ${{ matrix.build_flags }}
working-directory: ./dee
- name: cargo deb
uses: actions-rs/cargo@v1
with:
command: deb
args: --package dee --no-build --target ${{ matrix.target }} ${{ matrix.deb_flags }}
- name: Upload Debian package to release
uses: svenstaro/upload-release-action@2.5.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/debian/*.deb
tag: ${{ github.ref }}
file_glob: true
prerelease: true
if: github.event.inputs.test != 'true'