name: Release
on:
release:
types: [published]
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
steps:
- uses: actions/checkout@v7
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
- name: Install cross-compilation linker (aarch64-linux-gnu)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Prepare archive
shell: bash
run: |
BINARY="target/${{ matrix.target }}/release/react-auditor${{ matrix.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }}"
ARCHIVE_NAME="react-auditor-${{ matrix.target }}-${{ github.ref_name }}${{ matrix.archive == 'zip' && '.zip' || '.tar.gz' }}"
if [ "${{ matrix.archive }}" = "zip" ]; then
cp "$BINARY" react-auditor.exe
7z a "$ARCHIVE_NAME" react-auditor.exe
else
cp "$BINARY" react-auditor
tar czf "$ARCHIVE_NAME" react-auditor
fi
- uses: actions/upload-artifact@v7
with:
name: react-auditor-${{ matrix.target }}
path: react-auditor-*
create_release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
pattern: react-auditor-*
merge-multiple: true
- name: Save release tag for downstream workflows
run: echo "${{ github.ref_name }}" > RELEASE_TAG
- uses: actions/upload-artifact@v7
with:
name: release-tag
path: RELEASE_TAG
- uses: softprops/action-gh-release@v3
with:
files: react-auditor-*