Skip to content

Commit 0f65613

Browse files
committed
workflow to trigger cloud build whenever a pr is merged
1 parent a8d1f9f commit 0f65613

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Run on merge to master
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- Feature/build-automation
9+
10+
jobs:
11+
run-on-merge:
12+
runs-on: ubuntu-latest
13+
environment: github-pages
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
target:
19+
- ios-production
20+
21+
if: github.event.pull_request.merged == true
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Trigger Cloud Build
27+
id: trigger
28+
run: |
29+
branch_name="${{ github.head_ref || github.ref_name }}"
30+
31+
build_number=$(curl -s -X POST \
32+
-H "Authorization: Basic ${{ secrets.UNITY_API_KEY }}" \
33+
-H "Content-Type: application/json" \
34+
-d "{\"clean\": true, \"delay\": 0, \"commit\": null, \"headless\": true, \"branch\": \"$branch_name\"}" \
35+
https://build-api.cloud.unity3d.com/api/v1/orgs/6872789246035/projects/5fac262b-e52e-42f7-a9d6-d4464b2ff80e/buildtargets/${{ matrix.target }}/builds \
36+
| jq '.[0].build' )

0 commit comments

Comments
 (0)