Skip to content

bump cli version

bump cli version #11

Workflow file for this run

name: Release CLI
on:
push:
tags:
- "cli-v*" # CLI version tags
workflow_dispatch:
jobs:
release_build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# macOS builds
- os: macos-latest
target: x86_64-apple-darwin
name: renamify-macos-amd64
- os: macos-latest
target: aarch64-apple-darwin
name: renamify-macos-arm64
# Linux builds
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: renamify-linux-amd64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
name: renamify-linux-arm64
use-cross: true
# Windows builds
- os: windows-latest
target: x86_64-pc-windows-msvc
name: renamify-windows-amd64
- os: windows-latest
target: aarch64-pc-windows-msvc
name: renamify-windows-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Wait for required checks
uses: actions/github-script@v7
with:
script: |
const script = require('./.github/wait-for-checks.js');
await script({ github, context, core });
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Add rust target
if: (matrix.target == 'x86_64-apple-darwin' && matrix.os == 'macos-latest') || (matrix.target == 'aarch64-pc-windows-msvc' && matrix.os == 'windows-latest')
run: rustup target add ${{ matrix.target }}
- name: Install cross (for cross-compilation)
if: matrix.use-cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary
shell: bash
run: |
if [ "${{ matrix.use-cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} --bin renamify
else
cargo build --release --target ${{ matrix.target }} --bin renamify
fi
- name: Create archive
shell: bash
run: |
cd target/${{ matrix.target }}/release
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
# Windows: create a zip file
7z a ../../../${{ matrix.name }}.zip renamify.exe
cd ../../../
echo "ASSET_PATH=${{ matrix.name }}.zip" >> $GITHUB_ENV
else
# Unix: create a tar.gz file
tar czf ../../../${{ matrix.name }}.tar.gz renamify
cd ../../../
echo "ASSET_PATH=${{ matrix.name }}.tar.gz" >> $GITHUB_ENV
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ env.ASSET_PATH }}
release_create:
name: Create Release
needs: release_build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Get version from Cargo.toml
id: version
run: |
# Extract version from workspace Cargo.toml (since renamify-cli uses workspace version)
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" = "push" ]; then
# Verify tag matches Cargo.toml version
TAG="${GITHUB_REF#refs/tags/}"
EXPECTED_TAG="cli-v$VERSION"
if [ "$TAG" != "$EXPECTED_TAG" ]; then
echo "Error: Tag $TAG doesn't match expected $EXPECTED_TAG from Cargo.toml"
exit 1
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
else
# Workflow dispatch - create tag from Cargo.toml version
echo "tag=cli-v$VERSION" >> $GITHUB_OUTPUT
fi
- name: Generate changelog
id: changelog
run: |
./scripts/generate-changelog.sh cli "${{ steps.version.outputs.version }}" > changelog.md
echo "## Installation" >> changelog.md
echo "" >> changelog.md
echo "### macOS (Intel)" >> changelog.md
echo '```bash' >> changelog.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/$TAG/renamify-macos-amd64.tar.gz | tar xz -C /tmp" >> changelog.md
echo "sudo mv /tmp/renamify /usr/local/bin/" >> changelog.md
echo '```' >> changelog.md
echo "" >> changelog.md
echo "### macOS (Apple Silicon)" >> changelog.md
echo '```bash' >> changelog.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/$TAG/renamify-macos-arm64.tar.gz | tar xz -C /tmp" >> changelog.md
echo "sudo mv /tmp/renamify /usr/local/bin/" >> changelog.md
echo '```' >> changelog.md
echo "" >> changelog.md
echo "### Linux (x86_64)" >> changelog.md
echo '```bash' >> changelog.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/$TAG/renamify-linux-amd64.tar.gz | tar xz -C /tmp" >> changelog.md
echo "sudo mv /tmp/renamify /usr/local/bin/" >> changelog.md
echo '```' >> changelog.md
echo "" >> changelog.md
echo "### Linux (ARM64)" >> changelog.md
echo '```bash' >> changelog.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/$TAG/renamify-linux-arm64.tar.gz | tar xz -C /tmp" >> changelog.md
echo "sudo mv /tmp/renamify /usr/local/bin/" >> changelog.md
echo '```' >> changelog.md
echo "" >> changelog.md
echo "### Windows (x86_64)" >> changelog.md
echo '```powershell' >> changelog.md
echo "Invoke-WebRequest -Uri https://github.com/${{ github.repository }}/releases/download/$TAG/renamify-windows-amd64.zip -OutFile \$env:TEMP\\renamify.zip" >> changelog.md
echo "Expand-Archive -Path \$env:TEMP\\renamify.zip -DestinationPath \$env:TEMP" >> changelog.md
echo "Move-Item -Path \$env:TEMP\\renamify.exe -Destination C:\\Windows\\System32\\" >> changelog.md
echo '```' >> changelog.md
echo "" >> changelog.md
echo "### Windows (ARM64)" >> changelog.md
echo '```powershell' >> changelog.md
echo "Invoke-WebRequest -Uri https://github.com/${{ github.repository }}/releases/download/$TAG/renamify-windows-arm64.zip -OutFile \$env:TEMP\\renamify.zip" >> changelog.md
echo "Expand-Archive -Path \$env:TEMP\\renamify.zip -DestinationPath \$env:TEMP" >> changelog.md
echo "Move-Item -Path \$env:TEMP\\renamify.exe -Destination C:\\Windows\\System32\\" >> changelog.md
echo '```' >> changelog.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Renamify CLI v${{ steps.version.outputs.version }}
body_path: changelog.md
draft: false
prerelease: ${{ contains(steps.tag.outputs.tag, '-') }}
files: |
artifacts/**/*.tar.gz
artifacts/**/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}