name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.asset_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
asset_name: contextgrep-macos-arm64
binary: contextgrep
- os: macos-latest
target: x86_64-apple-darwin
asset_name: contextgrep-macos-x64
binary: contextgrep
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset_name: contextgrep-linux-x64
binary: contextgrep
- os: windows-latest
target: x86_64-pc-windows-msvc
asset_name: contextgrep-windows-x64.exe
binary: contextgrep.exe
steps:
- uses: actions/checkout@v4
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Stage binary (Unix)
if: runner.os != 'Windows'
run: cp target/${{ matrix.target }}/release/${{ matrix.binary }} ${{ matrix.asset_name }}
- name: Stage binary (Windows)
if: runner.os == 'Windows'
run: cp target\${{ matrix.target }}\release\${{ matrix.binary }} ${{ matrix.asset_name }}
- name: Upload to release
uses: softprops/action-gh-release@v2
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
with:
files: ${{ matrix.asset_name }}
generate_release_notes: true