Skip to content

chore(main): release 0.5.0 #5

chore(main): release 0.5.0

chore(main): release 0.5.0 #5

Workflow file for this run

name: Build Binaries when Tagging
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: linux-x86_64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: macos-aarch64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: windows-x86_64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
binary_name="afmt"
artifact_base="${binary_name}-${{ env.VERSION }}-${{ matrix.artifact_name }}"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.target }}/release/${binary_name}.exe" "${binary_name}.exe"
7z a "${artifact_base}.zip" "${binary_name}.exe"
echo "ASSET=${artifact_base}.zip" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/${binary_name}" "${binary_name}"
tar -czf "${artifact_base}.tar.gz" "${binary_name}"
echo "ASSET=${artifact_base}.tar.gz" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v
with:
files: ${{ env.ASSET }}