-
-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (94 loc) · 3.56 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
name: release
on:
push:
tags: ["v*"]
jobs:
publish:
name: crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout
- uses: actions/cache@v3
name: Configure cache
with:
path: |
~/.cargo/
./build/
key: publish-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: publish-cargo-
- run: |
rustup toolchain add nightly
rustup default nightly
name: Prepare
- run: cargo test
name: Test
- run: cargo publish
name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release:
strategy:
fail-fast: false
matrix:
release:
# TODO: Figure out how to "setup pkg-config for cross-compilation"
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# executable: kc
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
executable: kc
- os: windows-latest
target: aarch64-pc-windows-msvc
executable: kc.exe
- os: windows-latest
target: x86_64-pc-windows-msvc
executable: kc.exe
- os: macos-latest
target: aarch64-apple-darwin
executable: kc
- os: macos-latest
target: x86_64-apple-darwin
executable: kc
name: ${{ matrix.release.target }}
runs-on: ${{ matrix.release.os }}
needs: publish
steps:
- uses: actions/checkout@v3
name: Checkout
- uses: actions/cache@v3
name: Configure cache
with:
path: |
~/.cargo/
./build/
key: release-${{ matrix.release.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: release-${{ matrix.release.target }}-cargo-
- run: |
rustup toolchain add nightly
rustup default nightly
rustup target add ${{ matrix.release.target }}
name: Prepare — ${{ matrix.release.target }}
- run: cargo build --target ${{ matrix.release.target }} --release
name: Build — ${{ matrix.release.target }}
- run: tar -a -cf kc-${{ github.ref_name }}-${{ matrix.release.target }}.tar.gz ${{ matrix.release.executable }}
name: Package (tar) — ${{ matrix.release.target }}
working-directory: ./build/${{ matrix.release.target }}/release/
- run: zip -r kc-${{ github.ref_name }}-${{ matrix.release.target }}.zip ${{ matrix.release.executable }}
name: Package (zip) — ${{ matrix.release.target }}
working-directory: ./build/${{ matrix.release.target }}/release/
if: ${{ !startsWith(matrix.release.os, 'windows') }}
- run: Compress-Archive ${{ matrix.release.executable }} -DestinationPath kc-${{ github.ref_name }}-${{ matrix.release.target }}.zip
name: Package (zip) — ${{ matrix.release.target }}
working-directory: ./build/${{ matrix.release.target }}/release/
if: ${{ startsWith(matrix.release.os, 'windows') }}
- uses: softprops/action-gh-release@v1
name: Publish
# prerelease: true
with:
files: ./build/${{ matrix.release.target }}/release/kc-${{ github.ref_name }}-${{ matrix.release.target }}.*
# We don't want the archives to be stored in the cache of the build directory
- run: rm kc-${{ github.ref_name }}-${{ matrix.release.target }}.*
name: Cleanup
working-directory: ./build/${{ matrix.release.target }}/release/