Files
goose/.github/workflows/cli-release.yml
T
2025-01-02 16:53:37 +11:00

72 lines
1.9 KiB
YAML

on:
push:
tags:
- "v1.*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
name: Release CLI
jobs:
build:
name: Build ${{ matrix.os }}-${{ matrix.architecture }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
architecture: [ aarch64, x86_64 ]
include:
- os: ubuntu-latest
target-suffix: unknown-linux-gnu
- os: macos-latest
target-suffix: apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: build
run: |
export TARGET=${{ matrix.architecture }}-${{ matrix.target-suffix }}
rustup target add "${TARGET}"
cargo install cross --git https://github.com/cross-rs/cross
CROSS_NO_WARNINGS=0 cross build --release --target ${TARGET}
cd target/${TARGET}/release
tar -cjf goose-${TARGET}.tar.bz2 goose goosed
echo "ARTIFACT=target/${TARGET}/release/goose-${TARGET}.tar.bz2" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: goose-${{ matrix.architecture }}-${{ matrix.target-suffix }}
path: ${{ env.ARTIFACT }}
release:
name: Release
runs-on: ubuntu-latest
needs: [ build ]
permissions:
contents: write
steps:
# Step 1: Download all build artifacts
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
# Step 2: Create GitHub release with artifacts
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
artifacts: "goose-*.tar.bz2"
token: ${{ secrets.GITHUB_TOKEN }}