forked from dfinity/icx-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (87 loc) · 3.21 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
name: Release
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
rust: [ '1.55.0' ]
target: [ x86_64-apple-darwin, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu ]
include:
- os: macos-latest
target: x86_64-apple-darwin
binary_path: target/release
name: macos
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
binary_path: target/x86_64-unknown-linux-musl/release
name: linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_path: target/x86_64-unknown-linux-gnu/release
name: linux-gnu
steps:
- uses: actions/checkout@v2
- name: Setup environment variables
run: |
echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "OPENSSL_STATIC=yes" >> $GITHUB_ENV
echo ICX_VERSION=$(cargo metadata | jq -r '.["packages"][] | select(.name == "icx-proxy")["version"]') >> $GITHUB_ENV
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
if: contains(matrix.os, 'macos')
- name: Linux hack (musl only)
run: |
echo "1.58.1" >./rust-toolchain
if: contains(matrix.target, 'linux-musl')
- name: Linux build (musl)
uses: dfinity/rust-musl-action@master
with:
args: |
cargo install cargo-deb --target x86_64-unknown-linux-musl
echo "1.55.0" >./rust-toolchain
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" cargo deb --target x86_64-unknown-linux-musl -- --locked --features=skip_body_verification
if: contains(matrix.target, 'linux-musl')
- name: Linux build (gnu)
env:
RUSTFLAGS: --remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity
run: |
cargo build --locked --release --target x86_64-unknown-linux-gnu --features=skip_body_verification
cd ${{ matrix.binary_path }}
ldd icx-proxy
if: contains(matrix.target, 'linux-gnu')
- name: macOS build
env:
RUSTFLAGS: --remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity
run: |
cargo build --locked --release --features=skip_body_verification
cd target/release
otool -L icx-proxy
if: contains(matrix.os, 'macos')
- name: Create tarball of binaries
run: tar -zcC ${{ matrix.binary_path }} -f binaries.tar.gz icx-proxy
- name: Upload tarball
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: binaries.tar.gz
asset_name: binaries-${{ matrix.name }}.tar.gz
tag: ${{ env.SHA_SHORT }}
- name: Upload deb
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/x86_64-unknown-linux-musl/debian/icx-proxy_${{ env.ICX_VERSION }}_amd64.deb
asset_name: icx-proxy.deb
tag: ${{ env.SHA_SHORT }}
if: contains(matrix.target, 'linux-musl')