feat: Switch to native runner matrix for proper cross-platform builds #11
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- test-release # Test on specific branch | |
workflow_dispatch: # Allow manual testing | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
binary-name: shimmy | |
artifact-name: shimmy-linux-x86_64 | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
binary-name: shimmy.exe | |
artifact-name: shimmy-windows-x86_64.exe | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
binary-name: shimmy | |
artifact-name: shimmy-macos-intel | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
binary-name: shimmy | |
artifact-name: shimmy-macos-arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build binary | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: target/${{ matrix.target }}/release/${{ matrix.binary-name }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
- name: Prepare release files | |
run: | | |
mkdir -p release-files | |
# Copy and rename artifacts | |
cp artifacts/shimmy-linux-x86_64/shimmy release-files/shimmy-linux-x86_64 | |
cp artifacts/shimmy-linux-x86_64/shimmy release-files/shimmy # Generic name | |
cp artifacts/shimmy-windows-x86_64.exe/shimmy.exe release-files/shimmy-windows-x86_64.exe | |
cp artifacts/shimmy-windows-x86_64.exe/shimmy.exe release-files/shimmy.exe # Generic name | |
cp artifacts/shimmy-macos-intel/shimmy release-files/shimmy-macos-intel | |
cp artifacts/shimmy-macos-arm64/shimmy release-files/shimmy-macos-arm64 | |
# List what we're releasing | |
echo "Release files:" | |
ls -la release-files/ | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create ${{ github.ref_name }} \ | |
release-files/* \ | |
--title "Shimmy ${{ github.ref_name }}" \ | |
--generate-notes |