. #10
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-release: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
- os: macos-14 | |
target: x86_64-apple-darwin | |
- os: macos-14 | |
target: aarch64-apple-darwin | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build | |
run: cargo build --verbose --release --target ${{ matrix.target }} | |
- name: List builds | |
shell: pwsh | |
run: | | |
Get-ChildItem $(Join-Path -Path $(Get-Location) -ChildPath target -AdditionalChildPath ${{ matrix.target }},release) | |
- name: Archive artifacts | |
shell: pwsh | |
run: | | |
$isWin = "${{ matrix.os }}".StartsWith("windows-") | |
$archivePath = $isWin ? ".\target\${{ matrix.target }}\release\als.${{ matrix.target }}.zip" : "./target/${{ matrix.target }}/release/als.${{ matrix.target }}.tar.gz" | |
echo "ARCHIVE_PATH=$archivePath" >> $env:GITHUB_ENV | |
if ($isWin) { | |
Compress-Archive -Path .\target\${{ matrix.target }}\release\als.exe -DestinationPath $archivePath | |
} else { | |
tar -czf $archivePath ./target/${{ matrix.target }}/release/als | |
} | |
- name: List archive | |
shell: pwsh | |
run: | | |
Get-ChildItem $(Join-Path -Path $(Get-Location) -ChildPath target -AdditionalChildPath ${{ matrix.target }},release) | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: ${{ env.ARCHIVE_PATH }} |