chore(main): release 0.12.1 #20
Workflow file for this run
This file contains hidden or 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: Build Binaries when Tagging | |
# This is usually auto triggered by tagging from release-please gh | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
build-and-upload: | |
name: Build and upload | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
artifact_name: linux-x86_64 | |
- build: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
artifact_name: macos-x86_64 | |
- build: macos-arm | |
os: macos-latest | |
target: aarch64-apple-darwin | |
artifact_name: macos-aarch64 | |
- build: windows | |
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 | |
mv "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 | |
mv "target/${{ matrix.target }}/release/$binary_name" "${binary_name}" | |
tar -czf "${artifact_base}.tar.gz" "${binary_name}" | |
echo "ASSET=${artifact_base}.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
${{ env.ASSET }} |