Skip to content

Commit 2bdcbd0

Browse files
committed
Trigger bitrise build from CI
1 parent dcf191b commit 2bdcbd0

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Trigger Bitrise Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
# Only trigger when sample app or dependencies change
8+
- "sample/**"
9+
- "modules/**"
10+
- "package.json"
11+
- "yarn.lock"
12+
- "ios/**"
13+
- "android/**"
14+
- ".github/workflows/trigger-bitrise-build.yml"
15+
16+
workflow_dispatch: # Allow manual triggers
17+
18+
jobs:
19+
trigger-bitrise:
20+
name: Trigger Bitrise Build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Trigger Bitrise Pipeline
24+
env:
25+
BITRISE_APP_SLUG: ${{ secrets.BITRISE_APP_SLUG }}
26+
BITRISE_API_TOKEN: ${{ secrets.BITRISE_API_TOKEN }}
27+
run: |
28+
echo "🚀 Triggering Bitrise build for React Native sample apps..."
29+
30+
RESPONSE=$(curl -X POST \
31+
"https://app.bitrise.io/app/$BITRISE_APP_SLUG/build/start.json" \
32+
-H "Authorization: token $BITRISE_API_TOKEN" \
33+
-H "Content-Type: application/json" \
34+
-d @- <<EOF
35+
{
36+
"hook_info": {
37+
"type": "bitrise"
38+
},
39+
"build_params": {
40+
"branch": "${{ github.ref_name }}",
41+
"commit_hash": "${{ github.sha }}",
42+
"commit_message": $(echo '${{ github.event.head_commit.message }}' | jq -Rs .),
43+
"workflow_id": "build_and_upload_rn_sample_apps"
44+
}
45+
}
46+
EOF
47+
)
48+
49+
echo "Response: $RESPONSE"
50+
51+
# Extract build slug and URL
52+
BUILD_SLUG=$(echo "$RESPONSE" | jq -r '.build_slug // empty')
53+
BUILD_URL=$(echo "$RESPONSE" | jq -r '.build_url // empty')
54+
55+
if [ -n "$BUILD_SLUG" ]; then
56+
echo "✅ Bitrise build triggered successfully!"
57+
echo " Build URL: $BUILD_URL"
58+
echo " Build Slug: $BUILD_SLUG"
59+
else
60+
echo "❌ Failed to trigger Bitrise build"
61+
echo "$RESPONSE"
62+
exit 1
63+
fi
64+
65+
- name: Comment on PR (if applicable)
66+
if: github.event_name == 'pull_request'
67+
uses: actions/github-script@v7
68+
with:
69+
script: |
70+
github.rest.issues.createComment({
71+
issue_number: context.issue.number,
72+
owner: context.repo.owner,
73+
repo: context.repo.name,
74+
body: '🚀 Bitrise build triggered for sample app changes.\n\n[View build on Bitrise](https://app.bitrise.io/build/${{ env.BUILD_SLUG }})'
75+
})

0 commit comments

Comments
 (0)