From c26d8242cbf79c47d081b76b9599487fd85b5cea Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Feb 2026 04:27:53 +0530 Subject: [PATCH] chore: update GitHub Actions workflows to trigger on version bump completion --- .github/workflows/package-and-publish.yml | 16 +++++------ .github/workflows/package-android.yml | 13 ++++----- .github/workflows/typecheck.yml | 4 +-- .github/workflows/version-bump.yml | 35 +++++------------------ 4 files changed, 21 insertions(+), 47 deletions(-) diff --git a/.github/workflows/package-and-publish.yml b/.github/workflows/package-and-publish.yml index dd67e083b..92e2a7601 100644 --- a/.github/workflows/package-and-publish.yml +++ b/.github/workflows/package-and-publish.yml @@ -10,18 +10,18 @@ name: Package and publish on: workflow_dispatch: - push: - branches: - - main - # workflow_run: - # workflows: ["Version Bump"] - # types: - # - completed + # push: # branches: # - main - pull_request: + workflow_run: + workflows: ["Version Bump"] + types: + - completed branches: - main + # pull_request: + # branches: + # - main env: IS_PR: ${{ github.event_name == 'pull_request' }} diff --git a/.github/workflows/package-android.yml b/.github/workflows/package-android.yml index dcf78fb56..d91a00e1b 100644 --- a/.github/workflows/package-android.yml +++ b/.github/workflows/package-android.yml @@ -10,15 +10,12 @@ on: description: "Publish to release (requires main branch)" type: boolean default: false - push: + workflow_run: + workflows: ["Version Bump"] + types: + - completed branches: - - develop - # workflow_run: - # workflows: ['Version Bump'] - # types: - # - completed - # branches: - # - main + - main pull_request: branches: - main diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index a9e8a4c13..53b3a1869 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -2,9 +2,7 @@ name: Type Check on: push: - branches: ['*'] pull_request: - branches: ['*'] permissions: contents: read @@ -28,7 +26,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 24.x - cache: 'yarn' + cache: "yarn" - name: Cache node modules id: yarn-cache diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 3f3fcd929..07dc97c35 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest environment: Production # Skip if this is a version bump commit to avoid infinite loop - if: "!contains(github.event.head_commit.message, 'chore: bump version') && !contains(github.event.head_commit.message, '[skip ci]')" + if: "!contains(github.event.head_commit.message, 'chore: bump version')" steps: - name: Generate GitHub App token @@ -54,40 +54,19 @@ jobs: - name: Bump version id: version run: | - # Get current version from package.json + # Get current version CURRENT_VERSION=$(node -p "require('./package.json').version") - export CURRENT_VERSION echo "Current version: $CURRENT_VERSION" - # Compute new version (minor bump: x.y.z -> x.(y+1).0) - NEW_VERSION=$(node -e " - const v = process.env.CURRENT_VERSION.split('.').map(Number); - console.log([v[0], (v[1] || 0) + 1, 0].join('.')); - ") - export NEW_VERSION + # Bump minor version (creates commit and tag) + # The commit message includes [skip ci] to prevent triggering this workflow again + NEW_VERSION=$(npm version minor -m "chore: bump version to %s" | sed 's/v//') echo "New version: $NEW_VERSION" echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - # Update package.json - node -e " - const p = require('./package.json'); - p.version = process.env.NEW_VERSION; - require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n'); - " - - # Update tauri.conf.json to match - node -e " - const c = require('./src-tauri/tauri.conf.json'); - c.version = process.env.NEW_VERSION; - require('fs').writeFileSync('src-tauri/tauri.conf.json', JSON.stringify(c, null, 2) + '\n'); - " - - # Single commit and tag for package.json and tauri.conf.json - git add package.json src-tauri/tauri.conf.json - git commit -m "chore: bump version to $NEW_VERSION [skip ci]" - git tag "v$NEW_VERSION" - - name: Push changes + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} run: | # Push to main and tags using GitHub App token (remote URL already configured) git push origin main