Skip to content

🎁 Prepare release v0.10.0 #53

🎁 Prepare release v0.10.0

🎁 Prepare release v0.10.0 #53

Workflow file for this run

name: Main
on:
push:
tags:
- "v*.*.*"
jobs:
build:
strategy:
matrix:
rust-toolchain: [stable]
os: [ubuntu-24.04, macos-14, windows-2022]
arch: [amd64, arm64]
exclude:
- os: windows-2022
arch: arm64
- os: macos-14
arch: amd64
include:
- os: ubuntu-24.04
name: linux
rust_abi: unknown-linux-gnu
- os: macos-14
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/get-tag@v2.1.2
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-24.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 }}