-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (102 loc) · 3.7 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
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Release
uses: softprops/action-gh-release@v1
build:
runs-on: ${{ matrix.build-on }}
continue-on-error: true
needs: create-release
strategy:
matrix:
include:
- cpu: x86_64
os: win
target: x86_64-pc-windows-msvc
build-on: windows-latest
build-with: cargo
exe: ".exe"
run-tests: true
- cpu: x86_64
os: linux
target: x86_64-unknown-linux-musl
build-on: ubuntu-latest
build-with: cargo
exe: ""
run-tests: true
- cpu: aarch64
os: linux
target: aarch64-unknown-linux-musl
build-on: ubuntu-latest
build-with: cross
exe: ""
run-tests: false
- cpu: aarch64
os: macOS
target: aarch64-apple-darwin
build-on: macos-latest
build-with: cargo
exe: ""
run-tests: false
- cpu: x86_64
os: macOS
target: x86_64-apple-darwin
build-on: macos-latest
build-with: cargo
exe: ""
run-tests: true
name: Build Release ${{ matrix.cpu }} ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update musl tools
if: matrix.build-with == 'cargo' && matrix.os == 'linux'
run: |
sudo apt update
sudo apt install -y musl-tools
- name: Update Rust and add toolchain ${{ matrix.target }}
if: matrix.build-with == 'cargo'
run: |
rustup update
rustup target add ${{ matrix.target }}
- name: Install bin install if needed
if: matrix.build-with == 'cross'
run: |
wget -qO- https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz | tar xvz -C ~/.cargo/bin
- name: Install cross if needed
if: matrix.build-with == 'cross'
run: |
cargo binstall cross -y
- name: Build binary target/${{ matrix.target }}/release/erc20_processor
run: |
${{ matrix.build-with }} build --profile release-lto --target ${{ matrix.target }}
- name: Gz asset
run: |
mv target/${{ matrix.target }}/release-lto/gftp${{ matrix.exe }} target/${{ matrix.target }}/release-lto/erc20_processor${{ matrix.exe }}
tar -cf - -C target/${{ matrix.target }}/release-lto/ erc20_processor${{ matrix.exe }} | gzip -9 > erc20_processor.tar.gz
tar -cf - -C target/${{ matrix.target }}/release-lto/ erc20_processor${{ matrix.exe }} | xz -9 > erc20_processor.tar.xz
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: erc20_processor.tar.gz
asset_name: erc20_processor-${{ matrix.os }}-${{ matrix.cpu }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
body: "Gzipped binary for ${{ matrix.cpu }} ${{ matrix.os }}"
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: erc20_processor.tar.xz
asset_name: erc20_processor-${{ matrix.os }}-${{ matrix.cpu }}.tar.xz
tag: ${{ github.ref }}
overwrite: true
body: "Xzipped binary for ${{ matrix.cpu }} ${{ matrix.os }}"