mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 06:32:24 +00:00
chore: update GitHub Actions workflows to trigger on version bump completion
This commit is contained in:
@@ -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' }}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user