Skip to content

Rust Cross Compile Binary Release #5

Rust Cross Compile Binary Release

Rust Cross Compile Binary Release #5

Workflow file for this run

name: Rust Cross Compile Binary Release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag to create for this release"
required: true
jobs:
build-linux-windows:
name: Build and Release for Linux and Windows
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- aarch64-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install cross
run: |
sudo apt-get install -y qemu-user
cargo install cross
- name: Build
run: |
rustup target add ${{ matrix.target }}
cross build --target ${{ matrix.target }} --release
mkdir -p ./artifacts
if [ "${{ matrix.target }}" == "x86_64-pc-windows-gnu" ] || [ "${{ matrix.target }}" == "aarch64-pc-windows-msvc" ]; then
mv ./target/${{ matrix.target }}/release/stimmgabel.exe ./artifacts/${{ matrix.target }}-stimmgabel.exe
else
mv ./target/${{ matrix.target }}/release/stimmgabel ./artifacts/${{ matrix.target }}-stimmgabel
fi
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ github.repository }}-${{ matrix.target }}
path: ./artifacts/${{ matrix.target }}-stimmgabel*
build-macos:
name: Build and Release for MacOS
runs-on: macos-latest
strategy:
matrix:
target:
- aarch64-apple-darwin
- x86_64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }} --release
mkdir -p ./artifacts
mv ./target/${{ matrix.target }}/release/stimmgabel ./artifacts/${{ matrix.target }}-stimmgabel
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ github.repository }}-${{ matrix.target }}
path: ./artifacts/${{ matrix.target }}-stimmgabel
release:
name: Release
needs: [build-linux-windows, build-macos]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Create Tag
run: git tag ${{ github.event.inputs.tag }}
- name: Create and upload a Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: false
prerelease: false
title: ${{ github.event.inputs.tag }}
files: |
./artifacts/*