forked from ukhsa-collaboration/COVID-19-app-iOS-BETA
-
Notifications
You must be signed in to change notification settings - Fork 19
164 lines (146 loc) · 5.71 KB
/
deploy.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: deploy
on:
deployment
jobs:
upload:
runs-on:
- macos-10.15
outputs:
build-number: ${{ steps.tag-commit.outputs.build }}
tag: ${{ steps.tag-commit.outputs.tag }}
previous-tag: ${{ steps.tag-commit.outputs.previous-tag }}
steps:
- name: Checkout Project
uses: actions/checkout@01aeccc # v2.1.0
with:
fetch-depth: 0
- name: Switch to Xcode 11
run: sudo xcode-select -s /Applications/Xcode_11.app
- name: Install Fastlane
run: sudo gem install fastlane
- name: Setup Fastlane Match
env:
MATCH: ${{ secrets.match }}
run: ./bin/setup-match
- name: Upload to Test Flight
env:
API_ENDPOINT: ${{ secrets.api_endpoint }}
APPLE_USERNAME: ${{ secrets.apple_username }}
ENVIRONMENT_JSON_BETA: ${{ secrets.environment_json_beta }}
ENVIRONMENT_JSON_INTERNAL: ${{ secrets.environment_json_internal }}
ENVIRONMENT_JSON_PRODUCTION: ${{ secrets.environment_json_production }}
GOOGLE_SERVICE_INFO_PLIST_BETA: ${{ secrets.google_service_info_plist_beta }}
GOOGLE_SERVICE_INFO_PLIST_INTERNAL: ${{ secrets.google_service_info_plist_internal }}
GOOGLE_SERVICE_INFO_PLIST_PRODUCTION: ${{ secrets.google_service_info_plist_production }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.apple_password }}
MATCH_PASSWORD: ${{ secrets.match_password }}
run: fastlane release sonar_env:${{ github.event.deployment.environment }}
- name: Tag Commit
id: tag-commit
run: |
env_name=${{ github.event.deployment.environment }}
previous_tag=$(git tag --list | grep "$env_name" | tail -n 1)
echo "::set-output name=previous-tag::$previous_tag"
version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "Sonar/Info.plist")
build=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "Sonar/Info.plist")
tag="${env_name}-v${version}-${build}"
shortref=$(git rev-parse --short HEAD)
echo "::set-output name=shortref::${shortref}"
echo "::set-output name=version::${version}"
echo "::set-output name=build::${build}"
echo "::set-output name=tag::${tag}"
git tag ${tag}
git push origin ${tag}
- name: Upload IPA
if: always() # If the fastlane release fails, we can upload it manually
uses: actions/upload-artifact@e7eefc4 # v2
with:
name: Sonar-${{ steps.tag-commit.outputs.tag }}.ipa
path: Sonar.ipa
- name: Create App Report
working-directory: Reporting
run: swift run Reporter ipa ../Sonar.ipa --output AppReport
continue-on-error: true
- name: Upload App Report
uses: actions/upload-artifact@e7eefc4 # v2
with:
name: AppReport
path: Reporting/AppReport
# Job status is capitalized and deployment status is not, so we have this
# hack to lowercase the status
- name: Get Job Status
id: job-status
if: always()
run: echo "::set-output name=deployment-status::$(echo ${{ job.status }} | tr '[:upper:]' '[:lower:]')"
- name: Update Deployment Status
if: always()
run: >
curl
--verbose
--url "${{ github.event.deployment.statuses_url }}"
--header "authorization: Bearer ${{ secrets.deployment_token }}"
--header "content-type: application/json"
--data '{"state":"${{ steps.job-status.outputs.deployment-status }}"}'
continue-on-error: true
# - name: Notify Slack on Upload
# env:
# SLACK_BOT_TOKEN: ${{ secrets.slack_bot_token }}
# uses: voxmedia/github-action-slack-notify-build@5125947 # v1.1.1
# with:
# channel_id: G011ZPSAD4J
# status: uploaded [${{ steps.tag-commit.outputs.tag }}]
# - name: Notify Slack on Failure
# if: failure()
# env:
# SLACK_BOT_TOKEN: ${{ secrets.slack_bot_token }}
# uses: voxmedia/github-action-slack-notify-build@5125947 # v1.1.1
# with:
# channel_id: G011ZPSAD4J
# status: FAILED
# color: danger
# update-backlog:
# runs-on:
# - linux
# - aws
# needs: upload
# if: github.event.deployment.environment == 'internal'
# container: ruby:2.7
# steps:
# - name: Checkout Project
# uses: actions/checkout@01aeccc # v2.1.0
# with:
# fetch-depth: 0
#
# - name: Checkout Sonar CI Github Repo
# uses: actions/checkout@01aeccc #v2.1.0
# with:
# token: ${{ secrets.deployment_token }}
# repository: nhsx/sonar-ci-tools
# path: ci-tools
# ref: v0.2.0
#
# - name: Fetch tags
# run: git fetch --tags
#
# - name: Update Backlog
# uses: ./ci-tools/.github/actions/deliver_tracker_stories_with_build
# with:
# tracker_token: ${{ secrets.pivotal_tracker_api_token }}
# revision_range: ${{ needs.upload.outputs.previous-tag }}..${{ needs.upload.outputs.tag }}
# build_version: ${{ needs.upload.outputs.build-number }}
#
# tag-as-supported:
# runs-on:
# - linux
# - aws
#
# needs: upload
# container: pactfoundation/pact-cli
#
# steps:
# - name: Checkout Project
# uses: actions/checkout@01aeccc # v2.1.0
# - name: Tag published version as supported in pact broker
# run: pact-broker create-version-tag --tag "${{ needs.upload.outputs.tag }}" --pacticipant 'iOS App' --version "${{ needs.upload.outputs.shortref }}"
# env:
# PACT_BROKER_BASE_URL: https://sonar-pact-broker-app.apps.nonprod.aws.cp.data.england.nhs.uk