-
Notifications
You must be signed in to change notification settings - Fork 77
74 lines (65 loc) · 2.09 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
name: Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux
binary_path: target/x86_64-unknown-linux-musl/release
binary_files: icx
rust: '1.65.0'
- os: macos-latest
name: macos
binary_path: target/release
binary_files: icx
rust: '1.65.0'
steps:
- uses: actions/checkout@master
- name: Setup environment variables
run: |
echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "OPENSSL_STATIC=yes" >> $GITHUB_ENV
binaries=$(echo ${{ matrix.binary_files }} | xargs -n1 echo "--bin"|xargs)
echo "cargo_build_ARGS<<END" >> $GITHUB_ENV
echo "--locked --release $binaries" >> $GITHUB_ENV
echo "END" >> $GITHUB_ENV
- name: Static build
uses: dfinity/rust-musl-action@master
with:
args: cargo build --target x86_64-unknown-linux-musl ${{ env.cargo_build_ARGS }}
if: contains(matrix.os, 'ubuntu')
- name: Strip binaries
run: |
cd ${{ matrix.binary_path }}
sudo chown -R $(whoami) .
strip ${{ matrix.binary_files }}
if: contains(matrix.os, 'ubuntu')
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
if: contains(matrix.os, 'macos')
- name: Dynamic build
run: |
cargo build ${{ env.cargo_build_ARGS }}
cd ${{ matrix.binary_path }}
otool -L ${{ matrix.binary_files }}
if: contains(matrix.os, 'macos')
- name: Create tarball of binaries
run: tar -zcC ${{ matrix.binary_path }} -f binaries.tar.gz ${{ matrix.binary_files }}
- 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 }}