Rust Cross Compile Binary Release #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Cross Compile Binary Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Tag to create for this release" | |
required: true | |
jobs: | |
build: | |
name: Build and Release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- i686-unknown-linux-gnu | |
- aarch64-unknown-linux-gnu | |
- aarch64-apple-darwin | |
- x86_64-apple-darwin | |
- 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 }}-my_binary | |
release: | |
name: Release | |
needs: build | |
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: | | |
./* |