Skip to content

Add CI + release workflows for cross-platform binaries #1

Add CI + release workflows for cross-platform binaries

Add CI + release workflows for cross-platform binaries #1

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: arcx-linux-x86_64
use_cross: false
- name: linux-aarch64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: arcx-linux-aarch64
use_cross: true
- name: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
artifact: arcx-macos-x86_64
use_cross: false
- name: macos-aarch64
os: macos-latest
target: aarch64-apple-darwin
artifact: arcx-macos-aarch64
use_cross: false
- name: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
artifact: arcx-windows-x86_64.exe
use_cross: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --locked
- name: Build (cross)
if: matrix.use_cross
run: cross build --release --target ${{ matrix.target }}
- name: Build (cargo)
if: "!matrix.use_cross"
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/arcx ${{ matrix.artifact }}
- name: Rename binary (Windows)
if: runner.os == 'Windows'
run: |
cp target/${{ matrix.target }}/release/arcx.exe ${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -lR artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/*