-
Notifications
You must be signed in to change notification settings - Fork 6
83 lines (71 loc) · 2.41 KB
/
cli-build-executables.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
name: Rust Build Executable
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
target: x86_64-unknown-linux-gnu
- os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
- os: macos-latest
arch: aarch64
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v2
- name: Install Ubuntu Dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev
sudo apt-get install -y musl-tools
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo ln -s /usr/bin/aarch64-linux-gnu-gcc /usr/local/bin/aarch64-linux-musl-gcc
sudo ln -s /usr/bin/aarch64-linux-gnu-g++ /usr/local/bin/aarch64-linux-musl-g++
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Rename Output File
run: |
mv target/${{ matrix.target }}/release/mol target/${{ matrix.target }}/release/mol-${{ matrix.os }}-${{ matrix.arch }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: mol-${{ matrix.os }}-${{ matrix.arch }}
path: target/${{ matrix.target }}/release/mol-${{ matrix.os }}-${{ matrix.arch }}
# New job for creating the release and uploading all artifacts
create_release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
/home/runner/work/mol/mol/mol-ubuntu-latest-x86_64/mol-ubuntu-latest-x86_64
/home/runner/work/mol/mol/mol-macos-latest-x86_64/mol-macos-latest-x86_64
/home/runner/work/mol/mol/mol-macos-latest-aarch64/mol-macos-latest-aarch64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}