Skip to content

chore: bump version to 0.1.4 #6

chore: bump version to 0.1.4

chore: bump version to 0.1.4 #6

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish, for example v0.1.0"
required: true
type: string
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
binary: rtk-codex-hook
asset: rtk-codex-hook-x86_64-unknown-linux-musl.tar.gz
- os: macos-latest
target: x86_64-apple-darwin
binary: rtk-codex-hook
asset: rtk-codex-hook-x86_64-apple-darwin.tar.gz
- os: macos-latest
target: aarch64-apple-darwin
binary: rtk-codex-hook
asset: rtk-codex-hook-aarch64-apple-darwin.tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: rtk-codex-hook.exe
asset: rtk-codex-hook-x86_64-pc-windows-msvc.zip
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_TAG }}
- name: Install target
run: rustup target add ${{ matrix.target }}
- name: Install musl tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Verify Cargo version matches release tag
shell: pwsh
run: |
$tag = $env:RELEASE_TAG
if ($tag -notmatch '^v(?<version>\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)$') {
throw "Release tag must look like v1.2.3; got '$tag'"
}
$tagVersion = $Matches.version
$metadata = cargo metadata --locked --format-version 1 | ConvertFrom-Json
$cargoVersion = $metadata.packages |
Where-Object { $_.name -eq "rtk-codex-hook" } |
Select-Object -ExpandProperty version -First 1
if (-not $cargoVersion) {
throw "Cargo.toml package.version not found for rtk-codex-hook"
}
if ($cargoVersion -ne $tagVersion) {
throw "Cargo.toml version $cargoVersion does not match release tag $tag"
}
- name: Build
run: cargo build --profile dist --target ${{ matrix.target }} --locked
- name: Package Unix archive
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
mkdir -p dist/pkg
cp "target/${{ matrix.target }}/dist/${{ matrix.binary }}" dist/pkg/
tar -czf "dist/${{ matrix.asset }}" -C dist/pkg .
- name: Package Windows archive
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist/pkg | Out-Null
Copy-Item "target/${{ matrix.target }}/dist/${{ matrix.binary }}" dist/pkg/
Compress-Archive -Path dist/pkg/* -DestinationPath "dist/${{ matrix.asset }}" -Force
- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: dist/${{ matrix.asset }}
if-no-files-found: error
checksums:
name: Generate checksums
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Generate SHA256SUMS
run: |
find dist -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS
- name: Upload checksums
uses: actions/upload-artifact@v4
with:
name: SHA256SUMS
path: SHA256SUMS
if-no-files-found: error
publish:
name: Publish GitHub release
runs-on: ubuntu-latest
needs:
- build
- checksums
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Publish release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.RELEASE_TAG }}
generate_release_notes: true
files: dist/**/*