📦 Prepare 0.9.4 release #49
Workflow file for this run
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: Main | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
rust-toolchain: [stable] | |
os: [ubuntu-20.04, macos-11, windows-2022] | |
arch: [amd64, arm64] | |
exclude: | |
- os: windows-2022 | |
arch: arm64 | |
include: | |
- os: ubuntu-20.04 | |
name: linux | |
rust_abi: unknown-linux-gnu | |
- os: macos-11 | |
name: darwin | |
rust_abi: apple-darwin | |
- os: windows-2022 | |
name: windows | |
rust_abi: pc-windows-msvc | |
extension: .exe | |
- arch: arm64 | |
rust_arch: aarch64 | |
- arch: amd64 | |
rust_arch: x86_64 | |
runs-on: ${{ matrix.os }} | |
outputs: | |
draft_release_id: ${{ steps.release.outputs.id }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup toolchain install ${{ matrix.rust-toolchain }} --target ${{ matrix.rust_arch }}-${{ matrix.rust_abi }} | |
shell: bash | |
- name: Install C cross-compilation toolchain | |
if: ${{ matrix.name == 'linux' && matrix.arch != 'amd64' }} | |
run: | | |
sudo apt-get update | |
sudo apt install -f -y gcc-${{ matrix.rust_arch }}-linux-gnu | |
echo CC=${{ matrix.rust_arch }}-linux-gnu-gcc >> $GITHUB_ENV | |
echo RUSTFLAGS='-C linker=${{ matrix.rust_arch }}-linux-gnu-gcc' >> $GITHUB_ENV | |
- name: Extract tag name | |
uses: olegtarasov/[email protected] | |
id: tagName | |
- name: Build | |
run: | | |
cargo build --release --all --locked --target=${{ matrix.rust_arch }}-${{ matrix.rust_abi }} | |
- name: Strip symbols (linux) | |
if: ${{ matrix.name == 'linux' }} | |
run: | | |
${{ matrix.rust_arch }}-linux-gnu-strip target/${{ matrix.rust_arch }}-${{ matrix.rust_abi }}/release/viceroy${{ matrix.extension }} | |
- name: Strip symbols (non-linux) | |
if: ${{ matrix.name != 'linux' }} | |
run: | | |
strip target/${{ matrix.rust_arch }}-${{ matrix.rust_abi }}/release/viceroy${{ matrix.extension }} | |
- name: Package | |
run: | | |
cd target/${{ matrix.rust_arch }}-${{ matrix.rust_abi }}/release | |
tar czf viceroy_${{ steps.tagName.outputs.tag }}_${{ matrix.name }}-${{ matrix.arch }}.tar.gz viceroy${{ matrix.extension }} | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: | | |
target/${{ matrix.rust_arch }}-${{ matrix.rust_abi }}/release/viceroy_${{ steps.tagName.outputs.tag }}_${{ matrix.name }}-${{ matrix.arch }}.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: publish | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.repos.updateRelease({ | |
release_id: ${{ needs.build.outputs.draft_release_id }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
draft: false | |
}) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |