-
Notifications
You must be signed in to change notification settings - Fork 36
159 lines (144 loc) · 5.77 KB
/
build-deploy-alpha.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
name: Alpha - Build and Deploy
on:
workflow_dispatch:
inputs:
build_version_override:
description: >
Optional build version override. Leave blank (default value) to use the default value derived from the branch name
type: string
changelog:
description: >
Optional additional info about build
type: string
xcode_version_override:
description: >
Optional Xcode version override. Leave blank (default value) to use the default Xcode version;
pass a custom value (e.g. '16.0', '10.2.1', '11 Beta 7', '11.2 GM seed', etc) to use a different Xcode version for the build
type: string
concurrency:
group: '${{ github.workflow }} (${{ github.head_ref || github.ref_name }})'
cancel-in-progress: true
jobs:
prepare:
name: Prepare information
runs-on: ubuntu-latest
outputs:
version: '${{ steps.version.outputs.build_version }}'
stage: 'Alpha'
build_number: '${{ github.run_number }}'
changelog: '${{ steps.changelog.outputs.result }}'
steps:
- name: Jira Login
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: '${{ secrets.JIRA_URL }}'
JIRA_USER_EMAIL: '${{ secrets.JIRA_USER }}'
JIRA_API_TOKEN: '${{ secrets.JIRA_TOKEN }}'
- name: Get Jira Issue Number from Branch Name
id: jira
uses: tangem/jira-action@master
with:
action: getBranchSummary
branch-name: '${{ github.ref_name }}'
- name: Create version
id: version
env:
JIRA_ISSUE_KEY: '${{ steps.jira.outputs.key }}'
BUILD_VERSION_OVERRIDE: '${{ inputs.build_version_override }}'
run: |
if [[ -n "${BUILD_VERSION_OVERRIDE}" ]]; then
# Use the build version value from user input (if any)
BUILD_VERSION="${BUILD_VERSION_OVERRIDE}"
elif [[ -n "${JIRA_ISSUE_KEY}" ]]; then
# Use the build version value from Jira (if available)
BUILD_VERSION="${JIRA_ISSUE_KEY}"
else
# Fallback to default value
BUILD_VERSION="develop"
fi
echo "build_version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT"
- name: Create changelog
id: changelog
env:
JIRA_ISSUE_SUMMARY: '${{ steps.jira.outputs.summary }}'
JIRA_ISSUE_KEY: '${{ steps.jira.outputs.key }}'
ADDITIONAL_CHANGELOG: '${{ inputs.changelog }}'
run: |
JIRA_DESCRIPTION="${JIRA_ISSUE_KEY} ${JIRA_ISSUE_SUMMARY}"
if [[ "${JIRA_DESCRIPTION}" == " " ]]; then
JIRA_DESCRIPTION="N/A"
fi
JIRA_DESCRIPTION="Jira issue: ${JIRA_DESCRIPTION}"
if [[ -n "${ADDITIONAL_CHANGELOG}" ]]; then
OUTPUT_VALUE="Description: ${ADDITIONAL_CHANGELOG}"$'\n'"${JIRA_DESCRIPTION}"
else
OUTPUT_VALUE="${JIRA_DESCRIPTION}"
fi
# Workaround for a multi-line text in GH output
echo 'result<<EOF' >> $GITHUB_OUTPUT
echo "${OUTPUT_VALUE}" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
build:
name: Tangem Alpha
needs: prepare
uses: tangem/actions/.github/workflows/build.yml@feature/IOS-8113_ci_cd_beta_builds_workflow
with:
stage: '${{ needs.prepare.outputs.stage }}'
version: '${{ needs.prepare.outputs.version }}'
build_number: '${{ needs.prepare.outputs.build_number }}'
path: 'fastlane/builds/'
filename: 'Tangem-${{ needs.prepare.outputs.stage }}-${{ needs.prepare.outputs.version }}(${{ needs.prepare.outputs.build_number }}).ipa'
xcode_version_override: '${{ inputs.xcode_version_override }}'
secrets:
GH_MOBILE_PAT: '${{ secrets.GH_MOBILE_PAT }}'
deploy:
name: Google Distribution
uses: tangem/actions/.github/workflows/deploy-firebase.yml@feature/IOS-8113_ci_cd_beta_builds_workflow
needs:
- prepare
- build
with:
stage: '${{ needs.prepare.outputs.stage }}'
version: '${{ needs.prepare.outputs.version }}'
build_number: '${{ needs.prepare.outputs.build_number }}'
changelog: '${{ needs.prepare.outputs.changelog }}'
filename: 'Tangem-${{ needs.prepare.outputs.stage }}-${{ needs.prepare.outputs.version }}(${{ needs.prepare.outputs.build_number }}).ipa'
secrets:
FIREBASE_APP_ID: '${{ secrets.FIREBASE_APP_ID }}'
FIREBASE_CLI_TOKEN: '${{ secrets.FIREBASE_CLI_TOKEN }}'
GH_MOBILE_PAT: '${{ secrets.GH_MOBILE_PAT }}'
notification:
name: Deploy Notification
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8113_ci_cd_beta_builds_workflow
needs:
- prepare
- build
- deploy
with:
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}'
status: 'success'
app_name: '${{ vars.APP_ALPHA }}'
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}'
version: '${{ needs.prepare.outputs.version }}'
build_number: '${{ needs.prepare.outputs.build_number }}'
changelog: '${{ needs.prepare.outputs.changelog }}'
secrets:
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}'
error_notification:
name: Error Notification
# if: failure()
if: false # TODO: Test only, remove
uses: tangem/actions/.github/workflows/notification.yml@feature/IOS-8113_ci_cd_beta_builds_workflow
needs:
- prepare
- build
with:
channel: '${{ vars.SLACK_CHANNEL_DEPLOYMENTS_IOS }}'
status: 'error'
app_name: '${{ vars.APP_ALPHA }}'
deploy_to: '${{ vars.DEPLOYMENT_GOOGLE_DISTRIBUTION }}'
version: '${{ needs.prepare.outputs.version }}'
build_number: '${{ needs.prepare.outputs.build_number }}'
changelog: '${{ needs.prepare.outputs.changelog }}'
secrets:
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}'