forked from ukhsa-collaboration/COVID-19-app-iOS-BETA
-
Notifications
You must be signed in to change notification settings - Fork 19
83 lines (76 loc) · 2.57 KB
/
trigger-deploys.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
name: trigger-deploys
on:
# schedule:
# - cron: '0 * * * *'
repository_dispatch:
types: [trigger-deploys]
# push:
# branches:
# - ci
jobs:
should-deploy:
runs-on:
- macos-10.15
outputs:
should-deploy: ${{ steps.is-deployed.outputs.exit-code == '1' }}
steps:
- name: Checkout project
uses: actions/checkout@01aeccc # v2.1.0
with:
ref: internal
- name: Check if deployed
id: is-deployed
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
echo "::set-output name=exit-code::$(./bin/is-deployed internal > /dev/null; echo $?)"
bump-build-number:
needs: should-deploy
runs-on:
- macos-10.15
if: needs.should-deploy.outputs.should-deploy == 'true'
outputs:
commit-sha: ${{ steps.bump-build-version.outputs.commit-sha }}
steps:
- name: Checkout project
uses: actions/checkout@01aeccc # v2.1.0
with:
ref: internal
- name: Bump the build version
id: bump-build-version
env:
GIT_AUTHOR_NAME: GitHub Actions
GIT_AUTHOR_EMAIL: [email protected]
run: |
./bin/bump-build-version
git add Sonar/Info.plist
build_number=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "Sonar/Info.plist")
git commit --message="Bump build version number to $build_number"
echo "::set-output name=build-number::$build_number"
echo "::set-output name=commit-sha::$(git rev-parse HEAD)"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git push
deploy:
needs:
- should-deploy
- bump-build-number
runs-on:
- macos-10.15
strategy:
matrix:
run-config:
- { env: internal }
- { env: beta }
if: needs.should-deploy.outputs.should-deploy == 'true'
steps:
- name: Checkout project
uses: actions/checkout@01aeccc # v2.1.0
with:
ref: internal
- name: Trigger deployment
env:
DEPLOYMENT_TOKEN: ${{ secrets.deployment_token }}
DEPLOYMENT_SHA: ${{ needs.bump-build-number.outputs.commit-sha }}
DEPLOYMENT_PAYLOAD: 'This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**.\n\nThe commit hash was: _${{ steps.build-version.outputs.commit-sha }}_.'
DEPLOYMENT_DESCRIPTION: ${{ steps.bump-build-number.outputs.build-number }}
run: ./bin/create-deployment ${{ matrix.run-config['env'] }}