Skip to content

Publish CLI

Publish CLI #12

Workflow file for this run

name: Publish CLI
on:
workflow_dispatch:
inputs:
tag:
required: true
jobs:
publish-cli:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
target: "aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
target: "x86_64-apple-darwin"
- platform: "ubuntu-22.04" # Ubuntu 22.04 x86_64 (Works on 24.04 as well)
target: "x86_64-unknown-linux-gnu"
- platform: "windows-latest" # Windows x86_64
target: "x86_64-pc-windows-msvc"
args: "--features appbound"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Build
run: cargo build ${{ matrix.args }} --target ${{ matrix.target }} --package rookie-cli --bin rookie --release
- name: Rename Unix
run: mv target/${{ matrix.target }}/release/rookie rookie-cli-${{ matrix.target }}
if: contains(matrix.platform, 'macos') || contains(matrix.platform, 'ubuntu')
- name: Rename Windows
run: Move-Item target/${{ matrix.target }}/release/rookie.exe rookie-cli-${{ matrix.target }}.exe
if: contains(matrix.platform, 'windows')
- name: Upload Unix
run: gh release upload ${{ github.event.inputs.tag }} rookie-cli-${{ matrix.target }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: contains(matrix.platform, 'macos') || contains(matrix.platform, 'ubuntu')
- name: Upload Windows
run: gh release upload ${{ github.event.inputs.tag }} rookie-cli-${{ matrix.target }}.exe --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: contains(matrix.platform, 'windows')