-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 1.96 KB
/
Copy pathtrigger-bitrise.yml
File metadata and controls
70 lines (60 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Android CI - Trigger Bitrise
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate:
name: Run Code Checks
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Grant Permission to Execute Gradle
run: chmod +x ./gradlew
- name: Run Lint Checks
run: ./gradlew lint
continue-on-error: true # Prevents failure due to lint warnings
- name: Run Unit Tests
run: ./gradlew test
trigger-bitrise:
name: Trigger Bitrise Build
needs: validate
runs-on: ubuntu-latest
steps:
- name: Call Bitrise API to Start Build
run: |
curl -X POST "https://api.bitrise.io/v0.1/apps/${{ secrets.BITRISE_APP_SLUG }}/builds" \
-H "Authorization: ${{ secrets.BITRISE_PERSONAL_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{
"hook_info": { "type": "bitrise" },
"build_params": {
"branch": "main",
"workflow_id": "deploy"
},
"triggered_by": "GitHub Actions"
}'
- name: Wait for Bitrise Build to Complete
run: |
BITRISE_BUILD_URL="https://api.bitrise.io/v0.1/apps/${{ secrets.BITRISE_APP_SLUG }}/builds"
while true; do
STATUS=$(curl -s -H "Authorization: ${{ secrets.BITRISE_API_TOKEN }}" "$BITRISE_BUILD_URL" | jq -r '.data[].status_text')
echo "Current Bitrise Build Status: $STATUS"
if [[ "$STATUS" == "success" ]]; then
echo "Bitrise Build Succeeded!"
exit 0
elif [[ "$STATUS" == "failed" ]]; then
echo "Bitrise Build Failed!"
exit 1
fi
sleep 30 # Check every 30 seconds
done