Skip to content

Rust Cross Compile Binary Release #8

Rust Cross Compile Binary Release

Rust Cross Compile Binary Release #8

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:
name: Build and Release for Linux
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
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
mv ./target/${{ matrix.target }}/release/stimmgabel ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
path: ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
build-windows:
name: Build and Release for Windows
runs-on: windows-latest
strategy:
matrix:
target:
- x86_64-pc-windows-gnu
- aarch64-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
run: |
choco install rust-ms
echo "C:\Program Files\Rust stable GNU\bin" >> $GITHUB_PATH
rustup target add aarch64-pc-windows-msvc
rustup target add x86_64-pc-windows-gnu
- name: Build
run: |
cargo build --target ${{ matrix.target }} --release
mkdir .\artifacts
move .\target\${{ matrix.target }}\release\stimmgabel.exe .\artifacts\stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}.exe
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
path: .\artifacts\stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}.exe
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: stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
path: ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
release:
name: Release
needs: [build-linux, build-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/*