Skip to content

Release v0.6.0

Release v0.6.0 #15

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
run: rustup target add ${{ matrix.target }}
- name: Install Linux dependencies
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libxcb-screensaver0-dev
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (macOS .app bundle)
if: runner.os == 'macOS'
run: |
mkdir -p dist
./scripts/package-macos.sh target/${{ matrix.target }}/release/claude-usage dist
cd dist
zip -r ../claude-usage-${{ matrix.target }}.zip "Claude Usage.app"
- name: Package (Linux)
if: runner.os == 'Linux'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../claude-usage-${{ matrix.target }}.tar.gz claude-usage
- name: Package (windows)
if: runner.os == 'Windows'
run: Compress-Archive -Path target/${{ matrix.target }}/release/claude-usage.exe -DestinationPath claude-usage-${{ matrix.target }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: claude-usage-${{ matrix.target }}
path: claude-usage-${{ matrix.target }}.*
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Extract release notes from CHANGELOG
id: changelog
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
# Extract the section for this version from CHANGELOG.md
# Matches from "## [X.Y.Z]" to the next "## [" or end of file
NOTES=$(awk -v ver="$VERSION" '
/^## \[/ {
if (found) exit
if ($0 ~ "\\[" ver "\\]") found=1
next
}
found { print }
' CHANGELOG.md)
# If no notes found, use a default message
if [ -z "$NOTES" ]; then
NOTES="Release v$VERSION"
fi
# Write to file for the release action (handles multiline)
echo "$NOTES" > release-notes.md
echo "Extracted release notes:"
cat release-notes.md
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.VERSION }}
body_path: release-notes.md
generate_release_notes: true
draft: false
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}