-
Notifications
You must be signed in to change notification settings - Fork 76
70 lines (62 loc) · 2 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
name: Release
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
name: ['linux', 'macos']
include:
- os: ubuntu-latest
name: linux
target: x86_64-unknown-linux-musl
binary_path: target/x86_64-unknown-linux-musl/release
binary_files: icx
- os: macos-12
name: macos
target: x86_64-apple-darwin
binary_path: target/x86_64-apple-darwin/release
binary_files: icx
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: [email protected]
- 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: Build
run: |
cross build --target ${{ matrix.target }} ${{ env.cargo_build_ARGS }}
- name: Strip binaries
run: |
cd ${{ matrix.binary_path }}
sudo chown -R $(whoami) .
strip ${{ matrix.binary_files }}
if: ${{ contains(matrix.os, 'ubuntu') }}
- name: Check linkage
run: |
cd ${{ matrix.binary_path }}
otool -L ${{ matrix.binary_files }}
if: ${{ contains(matrix.os, 'macos') }}
- name: Create tarball of binaries
if: ${{ github.event_name == 'push' }}
run: tar -zcC ${{ matrix.binary_path }} -f binaries.tar.gz ${{ matrix.binary_files }}
- name: Upload tarball
if: ${{ github.event_name == 'push' }}
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 }}