-
Notifications
You must be signed in to change notification settings - Fork 2
146 lines (127 loc) · 4.16 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
on:
push:
tags:
- v*
name: Release
jobs:
quality:
uses: ./.github/workflows/quality.yml
release:
needs: [quality]
strategy:
matrix:
target:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- i686-pc-windows-msvc
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
include:
- target: aarch64-apple-darwin
os: macOS-latest
bin: kct
name: kct-darwin-aarch64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
bin: kct
name: kct-linux-gnu-aarch64
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
bin: kct
name: kct-linux-musl-aarch64
- target: i686-pc-windows-msvc
os: windows-latest
bin: kct.exe
name: kct-windows-msvc-i686.exe
- target: i686-unknown-linux-gnu
os: ubuntu-latest
bin: kct
name: kct-linux-gnu-i686
- target: i686-unknown-linux-musl
os: ubuntu-latest
bin: kct
name: kct-linux-musl-i686
- target: x86_64-apple-darwin
os: macOS-latest
bin: kct
name: kct-darwin-amd64
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
bin: kct
name: kct-linux-gnu-amd64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
bin: kct
name: kct-linux-musl-amd64
- target: x86_64-pc-windows-msvc
os: windows-latest
bin: kct.exe
name: kct-windows-msvc-amd64.exe
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
id: toolchain
uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
profile: minimal
toolchain: stable
override: true
- name: Configure cache
uses: ./.github/actions/cache
with:
rustc: ${{ steps.toolchain.outputs.rustc_hash }}
toolchain: read-write
- name: Linux x86 cross compiler
if: startsWith(matrix.target, 'i686-unknown-linux-')
run: sudo apt install gcc-multilib
- name: ARM cross compiler
if: startsWith(matrix.target, 'aarch64-unknown-linux-') && steps.cache.outputs.toolchain != 'true'
shell: bash
run: which cross || cargo install cross
- name: ARM gcc
if: startsWith(matrix.target, 'aarch64-unknown-linux-')
shell: bash
run: sudo apt install gcc-aarch64-linux-gnu
- name: Musl gcc
if: endsWith(matrix.target, '-musl')
shell: bash
run: sudo apt install musl musl-tools
- name: Run cross build
if: startsWith(matrix.target, 'aarch64-unknown-linux-')
shell: bash
run: cross build --bin=kct --release --target ${{ matrix.target }}
- name: Run build
if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
uses: actions-rs/cargo@v1
with:
command: build
args: --bin=kct --release --target ${{ matrix.target }}
- name: Create packages
shell: bash
run: |
cd target/${{ matrix.target }}/release
cp ${{ matrix.bin }} ../../../${{ matrix.name }}
- name: Generate SHA-256
if: matrix.os != 'windows-latest'
shell: bash
run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256
- name: Generate SHA-256 on Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: Get-FileHash ${{ matrix.name }} -Algorithm SHA256 | Out-File -FilePath ${{ matrix.name }}.sha256
- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: true
files: "kct*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}