Skip to content

Commit 756a850

Browse files
authored
Merge pull request selfxyz#1237 from selfxyz/justin/test-mobile-deploy-auto-pr
staging: test mobile deploy auto pull request (selfxyz#1234)
2 parents b5b0ba5 + a66c590 commit 756a850

File tree

7 files changed

+894
-226
lines changed

7 files changed

+894
-226
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Create Version Bump PR
2+
description: Creates a PR from staging changes onto dev branch
3+
inputs:
4+
platform:
5+
description: Platform name (ios or android)
6+
required: true
7+
version:
8+
description: Current version string
9+
required: true
10+
file_paths:
11+
description: File paths to include in the PR (newline separated)
12+
required: true
13+
github_token:
14+
description: GitHub token for creating PR
15+
required: true
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Create version bump PR
21+
shell: bash
22+
run: |
23+
BRANCH_NAME="ci/bump-${{ inputs.platform }}-build-${{ github.run_id }}"
24+
25+
git config user.name "github-actions[bot]"
26+
git config user.email "github-actions[bot]@users.noreply.github.com"
27+
28+
# Ensure we're on staging branch, not detached HEAD
29+
git fetch origin staging dev
30+
git checkout staging
31+
32+
# Check if staging has commits not in dev (version bumps + any build changes)
33+
COMMITS_AHEAD=$(git rev-list --count origin/dev..staging)
34+
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
39+
40+
echo "📊 Staging is $COMMITS_AHEAD commit(s) ahead of dev"
41+
42+
# Create new branch from current staging (which has all version changes)
43+
git checkout -b ${BRANCH_NAME}
44+
45+
# Push the branch
46+
git push --set-upstream origin ${BRANCH_NAME}
47+
48+
# Determine PR title based on platform
49+
if [ "${{ inputs.platform }}" = "mobile" ]; then
50+
PR_TITLE="chore: bump mobile app version to ${{ inputs.version }}"
51+
else
52+
PR_TITLE="chore: bump ${{ inputs.platform }} build for ${{ inputs.version }}"
53+
fi
54+
55+
gh pr create \
56+
--base dev \
57+
--head ${BRANCH_NAME} \
58+
--title "$PR_TITLE" \
59+
--body "Automated version bump by CI" \
60+
--label "automated"
61+
env:
62+
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)