-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.58 KB
/
build_and_publish.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
on:
pull_request:
push:
paths:
- "src/**"
- "Cargo*"
branches:
- master
tags:
- "v*.*.*"
name: Build and publish binaries
jobs:
build-and-publish:
name: Build and publish
runs-on: ubuntu-latest
strategy:
matrix:
target:
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Setup cache
uses: Swatinem/rust-cache@v2
- name: Build
run: cross build --release --target=${{ matrix.target }}
- name: Tar up binaries
if: startsWith(github.ref, 'refs/tags/')
run: |
if [[ ${{ matrix.target }} == "x86_64-pc-windows-gnu" ]]; then
mv target/${{ matrix.target }}/release/sbot.exe .
chmod +x sbot.exe
else
mv target/${{ matrix.target }}/release/sbot .
chmod +x sbot
fi
tar czvf sbot-${{ matrix.target }}.tar.gz sbot*
- name: Publish binaries to release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: "sbot*.tar.gz"
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}