Skip to content

chore: bump version #437

chore: bump version

chore: bump version #437

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
VITE_ENV: "production"
TAURI_DEBUG: "false"
jobs:
validate-version:
runs-on: ubuntu-24.04
steps:
- name: Validate version format
run: |
if ! [[ ${{ github.ref_name }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "Invalid version format. Must be vX.Y.Z or vX.Y.Z-suffix"
exit 1
fi
create-release-draft:
needs: validate-version
permissions:
contents: write
runs-on: ubuntu-24.04
outputs:
release_id: ${{ steps.create_release.outputs.id }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check existing release
id: check_release
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Attempt to get release ID and check if it's a valid number
release_id=$(gh api repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} --jq .id 2>/dev/null || echo "")
if [[ "$release_id" =~ ^[0-9]+$ ]]; then
echo "Release already exists with ID: $release_id"
echo "release_exists=true" >> "$GITHUB_OUTPUT"
echo "existing_release_id=$release_id" >> "$GITHUB_OUTPUT"
else
echo "Release does not exist"
echo "release_exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Create release draft
id: create_release
if: steps.check_release.outputs.release_exists != 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: "KFtray - ${{ github.ref_name }}"
draft: true
prerelease: false
- name: Set release ID output
run: |
if [ "${{ steps.check_release.outputs.release_exists }}" == "true" ]; then
echo "id=${{ steps.check_release.outputs.existing_release_id }}" >> "$GITHUB_OUTPUT"
else
echo "id=${{ steps.create_release.outputs.id }}" >> "$GITHUB_OUTPUT"
fi
kftray-tauri:
needs: create-release-draft
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-24.04
arch: arm64
runner: ubicloud-standard-4-arm
rust_target: aarch64-unknown-linux-gnu
tauri_args: "--target aarch64-unknown-linux-gnu --bundles appimage,updater --verbose"
- os: ubuntu-24.04
arch: amd64
rust_target: x86_64-unknown-linux-gnu
tauri_args: "--target x86_64-unknown-linux-gnu --bundles appimage,updater --verbose"
- os: macos-latest
arch: universal
rust_target: universal-apple-darwin
tauri_args: "--target universal-apple-darwin --bundles dmg,updater --verbose"
- os: windows-latest
arch: x86
rust_target: i686-pc-windows-msvc
tauri_args: "--target i686-pc-windows-msvc --bundles nsis,updater --verbose"
msvc_arch: x86
- os: windows-latest
arch: x86_64
rust_target: x86_64-pc-windows-msvc
tauri_args: "--target x86_64-pc-windows-msvc --bundles nsis,updater --verbose"
msvc_arch: x64
- os: windows-latest
arch: arm64
rust_target: aarch64-pc-windows-msvc
tauri_args: "--target aarch64-pc-windows-msvc --bundles nsis,updater --verbose"
runs-on: ${{ matrix.runner || matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: swatinem/rust-cache@v2
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: |
$(pnpm store path --silent)
**/node_modules
key: ${{ runner.OS }}-pnpm-${{ matrix.arch }}-${{ hashFiles('**/pnpm-lock.yaml', '**/package.json') }}
restore-keys: |
${{ runner.OS }}-pnpm-${{ matrix.arch }}-
- name: Set up Visual Studio shell
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64'
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: amd64_arm64
- name: Setup platform-specific dependencies
if: matrix.os == 'ubuntu-24.04'
run: |
if [ "${{ matrix.arch }}" == "arm64" ]; then
echo "deb http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/ubuntu-ports-jammy-main.list
else
echo "deb http://gb.archive.ubuntu.com/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/ubuntu-jammy-main.list
fi
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev libssl-dev
- name: Reconfigure Rust targets
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
rustup target add aarch64-apple-darwin x86_64-apple-darwin
else
rustup target add ${{ matrix.rust_target }}
fi
shell: bash
- name: Build kftray-tauri Desktop App
uses: tauri-apps/tauri-action@v0
id: tauri_build
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max-old-space-size=6000
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
with:
tagName: ${{ github.ref_name }}
releaseName: "KFtray - ${{ github.ref_name }}"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
updaterJsonKeepUniversal: true
args: ${{ matrix.tauri_args }}
- name: Retry Build on Failure
if: steps.tauri_build.outcome == 'failure'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max-old-space-size=6000
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
with:
tagName: ${{ github.ref_name }}
releaseName: "KFtray - ${{ github.ref_name }}"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
updaterJsonKeepUniversal: true
args: ${{ matrix.tauri_args }}
kftui:
needs: create-release-draft
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-24.04
arch: arm64
runner: ubicloud-standard-4-arm
rust_target: aarch64-unknown-linux-gnu
os_name: linux
- os: ubuntu-24.04
arch: amd64
rust_target: x86_64-unknown-linux-gnu
os_name: linux
- os: macos-latest
arch: universal
rust_target: universal-apple-darwin
os_name: macos
- os: windows-latest
arch: x86
rust_target: i686-pc-windows-msvc
msvc_arch: x86
os_name: windows
- os: windows-latest
arch: x86_64
rust_target: x86_64-pc-windows-msvc
msvc_arch: x64
os_name: windows
runs-on: ${{ matrix.runner || matrix.os }}
outputs:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust
uses: swatinem/rust-cache@v2
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: |
$(pnpm store path --silent)
**/node_modules
key: ${{ runner.OS }}-pnpm-${{ runner.ARCH }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.OS }}-pnpm-${{ runner.ARCH }}-
- name: Setup platform-specific dependencies
if: matrix.os == 'ubuntu-24.04'
run: |
if [ "${{ matrix.arch }}" == "arm64" ]; then
echo "deb http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/ubuntu-ports-jammy-main.list
else
echo "deb http://gb.archive.ubuntu.com/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/ubuntu-jammy-main.list
fi
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev libssl-dev
- name: Reconfigure Rust targets
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
rustup target add aarch64-apple-darwin x86_64-apple-darwin
else
rustup target add ${{ matrix.rust_target }}
fi
shell: bash
- name: Install OpenSSL on Windows
if: matrix.os == 'windows-latest'
run: choco install openssl
- name: Set up Perl on Windows
if: matrix.os == 'windows-latest'
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: "5.32"
distribution: "strawberry"
- name: Set Perl environment variables
if: matrix.os == 'windows-latest'
run: |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Build kftui
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
cargo build --release --bin kftui --target aarch64-apple-darwin
cargo build --release --bin kftui --target x86_64-apple-darwin
lipo -create -output ./target/release/kftui ./target/x86_64-apple-darwin/release/kftui ./target/aarch64-apple-darwin/release/kftui
else
cargo build --release --bin kftui --target ${{ matrix.rust_target }}
fi
shell: bash
- name: Sign and notarize the release build
if: matrix.os == 'macos-latest'
uses: toitlang/action-macos-sign-notarize@v1.2.0
with:
certificate: ${{ secrets.APPLE_CERTIFICATE }}
certificate-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
username: ${{ secrets.APPLE_ID }}
password: ${{ secrets.APPLE_PASSWORD }}
apple-team-id: 6M376JWU73
app-path: target/release/kftui
entitlements-path: crates/kftui/entitlements.plist
- name: Rename and upload release asset
run: |
if [ "${{ matrix.os }}" == "macos-latest" ]; then
mv ./target/release/kftui ./target/release/kftui_macos_universal
gh release upload ${{ github.ref_name }} ./target/release/kftui_macos_universal --clobber
elif [ "${{ matrix.os }}" == "windows-latest" ]; then
mv ./target/${{ matrix.rust_target }}/release/kftui.exe ./target/release/kftui_${{ matrix.os_name }}_${{ matrix.arch }}.exe
chmod +x ./target/release/kftui_${{ matrix.os_name }}_${{ matrix.arch }}.exe
gh release upload ${{ github.ref_name }} ./target/release/kftui_${{ matrix.os_name }}_${{ matrix.arch }}.exe
else
mv ./target/${{ matrix.rust_target }}/release/kftui ./target/release/kftui_${{ matrix.os_name }}_${{ matrix.arch }}
chmod +x ./target/release/kftui_${{ matrix.os_name }}_${{ matrix.arch }}
gh release upload ${{ github.ref_name }} ./target/release/kftui_${{ matrix.os_name }}_${{ matrix.arch }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
shell: bash
kftray-server:
permissions:
contents: write
packages: write
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: ./crates/kftray-server
file: ./crates/kftray-server/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/kftray-server:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/kftray-server:${{ github.ref_name }}
ghcr.io/${{ github.repository_owner }}/kftray-server:latest
update-release:
needs: [kftray-tauri, kftui, kftray-server, create-release-draft]
permissions:
contents: write
runs-on: ubuntu-24.04
if: |
startsWith(github.ref, 'refs/tags/v') &&
!contains(github.ref, '-beta') &&
!contains(github.ref, '-alpha')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --latest --strip header
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update release notes
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.create-release-draft.outputs.release_id }},
body: `${{ steps.git-cliff.outputs.content }}`,
tag_name: process.env.GITHUB_REF_NAME,
name: `KFtray - ${process.env.GITHUB_REF_NAME}`
});
} catch (error) {
console.error('Failed to update release notes:', error);
if (error.status === 404) {
console.log('Release not found, retrying after short delay...');
await new Promise(resolve => setTimeout(resolve, 5000));
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.create-release-draft.outputs.release_id }},
body: `${{ steps.git-cliff.outputs.content }}`,
tag_name: process.env.GITHUB_REF_NAME,
name: `KFtray - ${process.env.GITHUB_REF_NAME}`
});
} else {
throw error;
}
}
- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create-release-draft.outputs.release_id }}
update-homebrew:
needs: [update-release]
permissions:
contents: write
runs-on: macos-latest
if: |
startsWith(github.ref, 'refs/tags/v') &&
!contains(github.ref, '-beta') &&
!contains(github.ref, '-alpha')
steps:
- name: Checkout main repository
uses: actions/checkout@v4
- name: Update Homebrew formulas
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
chmod +x ./hacks/update-homebrew.sh
./hacks/update-homebrew.sh \
"${{ github.repository }}" \
"${{ github.ref_name }}" \
"hcavarsan/homebrew-kftray" \
"${{ secrets.GH_PAT }}"