-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (82 loc) · 2.84 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
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
publish:
name: Publishing for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
rust: [ stable ]
include:
- target: x86_64-apple-darwin
os: macos-latest
artifact_prefix: macos
cross: false
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact_prefix: linux
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact_prefix: windows
cross: false
# TODO fix openssl issue
# - target: x86_64-unknown-linux-musl
# os: ubuntu-latest
# artifact_prefix: linux-musl
# cross: false
# - target: armv7-unknown-linux-gnueabihf
# os: ubuntu-latest
# artifact_prefix: armv7
# cross: true
steps:
- name: Sync Rustup toolchain
run: rustup show
- name: Installing needed Ubuntu dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y -qq pkg-config libssl-dev
- name: Checking out sources
uses: actions/checkout@v3
- name: Running cargo build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --target ${{ matrix.target }}
- name: Packaging final binary (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
cd target/${{ matrix.target }}/release
BINARY_NAME=mlbt.exe
strip $BINARY_NAME
RELEASE_NAME=mlbt-${{ matrix.artifact_prefix }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
- name: Packaging final binary (macOS and Linux)
if: matrix.os != 'windows-latest'
shell: bash
run: |
cd target/${{ matrix.target }}/release
BINARY_NAME=mlbt
strip $BINARY_NAME
RELEASE_NAME=mlbt-${{ matrix.artifact_prefix }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.target }}/release/mlbt-${{ matrix.artifact_prefix }}.tar.gz
target/${{ matrix.target }}/release/mlbt-${{ matrix.artifact_prefix }}.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}