Skip to content

build with target/arch in binary name #14

build with target/arch in binary name

build with target/arch in binary name #14

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 }} --bin 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-ubuntu-latest-aarch64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}