Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions .github/actions/create-version-bump-pr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,24 @@ runs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Check if there are changes
git add ${{ inputs.file_paths }}
if [[ -z $(git status -s) ]]; then
echo "No changes to commit. Skipping PR creation."
exit 0
fi
# Ensure we're on staging branch, not detached HEAD
git fetch origin staging dev
git checkout staging

# Commit changes on temporary branch
git checkout -b temp-version-commit
git commit -m "chore: bump ${{ inputs.platform }} version for ${{ inputs.version }} [skip ci]"
# Check if staging has commits not in dev (version bumps + any build changes)
COMMITS_AHEAD=$(git rev-list --count origin/dev..staging)

# Create new branch from dev
git fetch origin dev
git checkout -b ${BRANCH_NAME} origin/dev
if [ "$COMMITS_AHEAD" -eq 0 ]; then
echo "ℹ️ No new commits on staging compared to dev. Skipping PR creation."
exit 0
fi

# Cherry-pick only the version changes
git cherry-pick temp-version-commit
echo "📊 Staging is $COMMITS_AHEAD commit(s) ahead of dev"

# Clean up temporary branch
git branch -D temp-version-commit
# Create new branch from current staging (which has all version changes)
git checkout -b ${BRANCH_NAME}

# Push and create PR
# Push the branch
git push --set-upstream origin ${BRANCH_NAME}

# Determine PR title based on platform
Expand All @@ -60,6 +56,7 @@ runs:
--base dev \
--head ${BRANCH_NAME} \
--title "$PR_TITLE" \
--body "Automated version bump by CI"
--body "Automated version bump by CI" \
--label "automated"
env:
GH_TOKEN: ${{ inputs.github_token }}
7 changes: 7 additions & 0 deletions .github/actions/get-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ inputs:
description: "Path to the app directory"
required: true

outputs:
version:
description: "Extracted app version from package.json"
value: ${{ steps.get-version.outputs.version }}

runs:
using: "composite"
steps:
- name: Get version from package.json
id: get-version
shell: bash
run: |
VERSION=$(node -p "require('${{ inputs.app_path }}/package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_ENV
Loading
Loading