Files
claude-code-usage-bubble/.github/workflows/release.yml
T
tiennm99 713eb5bbde ci: bump actions to latest, pin windows runner
- actions/checkout v4 -> v6 (Node 24, addresses Node 20 deprecation).
- runs-on windows-latest -> windows-2025 (current image; pin avoids
  silent surprise when GitHub redirects windows-latest to a newer
  image mid-2026).
- Swatinem/rust-cache@v2 retained (v2 floating tag still maintained;
  latest is v2.9.1 under that major).
2026-05-18 11:00:39 +07:00

66 lines
2.1 KiB
YAML

name: Release
on:
push:
tags: ['v*.*.*']
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (must already exist, e.g. v0.1.1)'
required: true
permissions:
contents: write
jobs:
build:
# Pinned explicitly: `windows-latest` is being redirected to a newer image
# by GitHub in mid-2026 — pin the current Windows Server 2025 image so
# release behavior is deterministic across that transition.
runs-on: windows-2025
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: Swatinem/rust-cache@v2
- name: Resolve tag
id: tag
shell: pwsh
run: |
$tag = if ($env:GITHUB_REF -like 'refs/tags/*') {
$env:GITHUB_REF -replace '^refs/tags/',''
} else {
'${{ github.event.inputs.tag }}'
}
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Verify Cargo.toml version matches tag
shell: pwsh
run: |
$tag = '${{ steps.tag.outputs.tag }}'
$expected = $tag -replace '^v',''
$cargoVersion = (Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"([^"]+)"' | Select-Object -First 1).Matches.Groups[1].Value
if ($cargoVersion -ne $expected) {
Write-Error "Tag ($tag -> $expected) does not match Cargo.toml version ($cargoVersion). Bump Cargo.toml before tagging."
exit 1
}
Write-Host "Cargo version $cargoVersion matches tag $tag"
- name: Build release
run: cargo build --release --locked
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
run: |
$tag = '${{ steps.tag.outputs.tag }}'
$asset = 'target/release/claude-code-usage-bubble.exe'
if ('${{ github.event_name }}' -eq 'workflow_dispatch') {
gh release create $tag $asset --title $tag --generate-notes --draft
} else {
gh release create $tag $asset --title $tag --generate-notes
}