fix: release #9
Workflow file for this run
This file contains hidden or 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: Release | |
on: | |
push: | |
tags: ["v*"] | |
permissions: | |
contents: write # Only permission needed for releases | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_notes: ${{ steps.release-notes.outputs.NOTES }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract Release Notes | |
id: release-notes | |
run: | | |
# Extract content between the latest version headers in CHANGELOG.md | |
VERSION=${GITHUB_REF#refs/tags/} | |
NOTES=$(awk -v ver="$VERSION" ' | |
/^## \[/ { if (p) { exit }; if ($2 == "['ver']") { p=1; next } } | |
p { print } | |
' CHANGELOG.md) | |
echo "NOTES<<EOF" >> $GITHUB_OUTPUT | |
echo "$NOTES" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
build-release: | |
needs: create-release | |
strategy: | |
matrix: | |
platform: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
asset_name: linux | |
- os: macos-latest # For Intel Macs (x86_64) | |
target: x86_64-apple-darwin | |
asset_name: darwin | |
- os: macos-latest # For Apple Silicon Macs (ARM64) | |
target: aarch64-apple-darwin | |
asset_name: darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
asset_name: windows | |
env: | |
BINARY_NAME: zparse-${{ matrix.platform.asset_name }}${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.platform.target }} | |
- name: Build Binary | |
run: cargo build --release --target ${{ matrix.platform.target }} | |
- name: Prepare Asset | |
shell: bash | |
run: | | |
mkdir -p release | |
cp target/${{ matrix.platform.target }}/release/$BINARY_NAME \ | |
release/$BINARY_NAME | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: release/${{ env.BINARY_NAME }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |