Skip to content

Commit fe04ab2

Browse files
authored
SELF-832: tweak mobile deploy auto bump version pr feature; v2.7.0 (#1244)
* bump version to match staging * save wip * deploy fixes * fix version setting * update version logic * fix version pr * increase timeout to 2 hours * pr logic tweaks * fix script * fix script path * add comments and update logic to test from feature branch * fix build path * fix version input error * fix pulling version * add skip-deploy lable * address cr concners
1 parent e4382d1 commit fe04ab2

File tree

8 files changed

+865
-203
lines changed

8 files changed

+865
-203
lines changed

.github/actions/create-version-bump-pr/action.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,24 @@ runs:
2525
git config user.name "github-actions[bot]"
2626
git config user.email "github-actions[bot]@users.noreply.github.com"
2727
28-
# Check if there are changes
29-
git add ${{ inputs.file_paths }}
30-
if [[ -z $(git status -s) ]]; then
31-
echo "No changes to commit. Skipping PR creation."
32-
exit 0
33-
fi
28+
# Ensure we're on staging branch, not detached HEAD
29+
git fetch origin staging dev
30+
git checkout staging
3431
35-
# Commit changes on temporary branch
36-
git checkout -b temp-version-commit
37-
git commit -m "chore: bump ${{ inputs.platform }} version for ${{ inputs.version }} [skip ci]"
32+
# Check if staging has commits not in dev (version bumps + any build changes)
33+
COMMITS_AHEAD=$(git rev-list --count origin/dev..staging)
3834
39-
# Create new branch from dev
40-
git fetch origin dev
41-
git checkout -b ${BRANCH_NAME} origin/dev
35+
if [ "$COMMITS_AHEAD" -eq 0 ]; then
36+
echo "ℹ️ No new commits on staging compared to dev. Skipping PR creation."
37+
exit 0
38+
fi
4239
43-
# Cherry-pick only the version changes
44-
git cherry-pick temp-version-commit
40+
echo "📊 Staging is $COMMITS_AHEAD commit(s) ahead of dev"
4541
46-
# Clean up temporary branch
47-
git branch -D temp-version-commit
42+
# Create new branch from current staging (which has all version changes)
43+
git checkout -b ${BRANCH_NAME}
4844
49-
# Push and create PR
45+
# Push the branch
5046
git push --set-upstream origin ${BRANCH_NAME}
5147
5248
# Determine PR title based on platform
@@ -60,6 +56,7 @@ runs:
6056
--base dev \
6157
--head ${BRANCH_NAME} \
6258
--title "$PR_TITLE" \
63-
--body "Automated version bump by CI"
59+
--body "Automated version bump by CI" \
60+
--label "automated"
6461
env:
6562
GH_TOKEN: ${{ inputs.github_token }}

.github/actions/get-version/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ inputs:
77
description: "Path to the app directory"
88
required: true
99

10+
outputs:
11+
version:
12+
description: "Extracted app version from package.json"
13+
value: ${{ steps.get-version.outputs.version }}
14+
1015
runs:
1116
using: "composite"
1217
steps:
1318
- name: Get version from package.json
19+
id: get-version
1420
shell: bash
1521
run: |
1622
VERSION=$(node -p "require('${{ inputs.app_path }}/package.json').version")
23+
echo "version=$VERSION" >> $GITHUB_OUTPUT
1724
echo "VERSION=$VERSION" >> $GITHUB_ENV

0 commit comments

Comments
 (0)