Skip to content

feat: add path filters to CI/Release workflows #9

feat: add path filters to CI/Release workflows

feat: add path filters to CI/Release workflows #9

Workflow file for this run

name: Release
on:
push:
branches:
- master
- main
paths:
- 'src/**'
- 'src-tauri/**'
- 'package.json'
- 'package-lock.json'
- 'tsconfig*.json'
- 'vite.config.ts'
- 'tailwind.config.js'
- 'postcss.config.js'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/release.yml'
tags:
- 'v*'
workflow_dispatch:
inputs:
bump:
description: 'Version bump type'
required: false
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
bump-and-release:
name: Bump Version & Create Release
runs-on: ubuntu-latest
# Skip if the commit was made by this workflow (prevent infinite loop)
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'chore: bump version')"
outputs:
release_id: ${{ steps.create_release.outputs.id }}
version: ${{ steps.bump.outputs.new_version }}
tag_name: ${{ steps.bump.outputs.tag_name }}
should_build: ${{ steps.bump.outputs.should_build }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Bump version
id: bump
run: |
# Read current version
CURRENT=$(jq -r .version src-tauri/tauri.conf.json)
echo "Current version: $CURRENT"
# Determine bump type
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
# Tag push — use the tag version directly
NEW_VERSION="${GITHUB_REF#refs/tags/v}"
echo "Tag push: using version $NEW_VERSION"
elif [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
BUMP="${{ github.event.inputs.bump }}"
echo "Manual dispatch with bump=$BUMP"
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
case "$BUMP" in
major) NEW_VERSION="$((MAJOR+1)).0.0" ;;
minor) NEW_VERSION="${MAJOR}.$((MINOR+1)).0" ;;
patch) NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH+1))" ;;
esac
else
# Branch push — auto bump patch
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH+1))"
echo "Branch push: auto bumping patch $CURRENT → $NEW_VERSION"
fi
TAG_NAME="v${NEW_VERSION}"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
# Check if tag already exists (for tag pushes)
if [[ "$GITHUB_REF" == refs/tags/v* ]] && git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "should_build=true" >> $GITHUB_OUTPUT
else
echo "should_build=true" >> $GITHUB_OUTPUT
fi
# Update version in config files (only for branch pushes and manual dispatch)
if [[ "$GITHUB_REF" != refs/tags/v* ]]; then
# Update tauri.conf.json
jq --arg v "$NEW_VERSION" '.version = $v' src-tauri/tauri.conf.json > tmp.json && mv tmp.json src-tauri/tauri.conf.json
# Update package.json
jq --arg v "$NEW_VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json
# Update workspace Cargo.toml version
sed -i "s/^version = \".*\"/version = \"$NEW_VERSION\"/" Cargo.toml
echo "Updated version files to $NEW_VERSION"
fi
- name: Commit version bump
if: github.ref != 'refs/tags/*'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Only commit if there are changes
if git diff --quiet; then
echo "No version changes to commit"
else
git add src-tauri/tauri.conf.json package.json Cargo.toml
git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }} [skip ci]"
git push origin HEAD:${{ github.ref_name }}
fi
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.bump.outputs.tag_name }}
name: VibeShell ${{ steps.bump.outputs.tag_name }}
body: |
## VibeShell ${{ steps.bump.outputs.tag_name }}
### Downloads
| Platform | File |
|----------|------|
| Windows x64 | `VibeShell_${{ steps.bump.outputs.new_version }}_x64-setup.exe` / `.msi` |
| macOS (Apple Silicon) | `VibeShell_${{ steps.bump.outputs.new_version }}_aarch64.dmg` |
| macOS (Intel) | `VibeShell_${{ steps.bump.outputs.new_version }}_x64.dmg` |
| Linux x64 | `.deb` / `.AppImage` |
### What's Changed
See [commit history](https://github.com/${{ github.repository }}/commits/${{ steps.bump.outputs.tag_name }}) for full changes.
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-tauri:
name: Build (${{ matrix.name }})
needs: bump-and-release
if: needs.bump-and-release.outputs.should_build == 'true'
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
name: Windows x64
args: ''
- platform: macos-latest
name: macOS ARM64
args: '--target aarch64-apple-darwin'
- platform: macos-latest
name: macOS x64
args: '--target x86_64-apple-darwin'
- platform: ubuntu-22.04
name: Linux x64
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
# Pull latest commit (including version bump)
ref: ${{ github.ref_name }}
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install frontend dependencies
run: npm ci
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.bump-and-release.outputs.release_id }}
args: ${{ matrix.args }}