name: Build and Release
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: dynamic_grounding_for_github_copilot.exe
asset_name: dynamic_grounding_for_github_copilot-windows-x64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: dynamic_grounding_for_github_copilot
asset_name: dynamic_grounding_for_github_copilot-darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: dynamic_grounding_for_github_copilot
asset_name: dynamic_grounding_for_github_copilot-darwin-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: dynamic_grounding_for_github_copilot
asset_name: dynamic_grounding_for_github_copilot-linux-x64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: dynamic_grounding_for_github_copilot
asset_name: dynamic_grounding_for_github_copilot-linux-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare artifact
shell: bash
run: |
cd target/${{ matrix.target }}/release
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp ${{ matrix.artifact_name }} ../../../${{ matrix.asset_name }}
else
cp ${{ matrix.artifact_name }} ../../../${{ matrix.asset_name }}
chmod +x ../../../${{ matrix.asset_name }}
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}