-
Notifications
You must be signed in to change notification settings - Fork 51
140 lines (126 loc) · 4.64 KB
/
deploy_internal_builds.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
name: Deploy to Firebase
on:
push:
branches:
- 'develop'
workflow_dispatch:
inputs:
build_description:
description: >
Optional additional info about the build
type: string
workflow_call:
secrets:
FIREBASE_APP_ID_INTERNAL:
required: true
FIREBASE_CLI_TOKEN:
required: true
# Token must have read access to all the submodule repositories
GH_MOBILE_PAT:
required: true
env:
INITIAL_VERSION_CODE: ${{ 1000 }}
jobs:
build_and_upload:
name: Upload apk to Firebase
runs-on: [ self-hosted, ARM64, active-android, Linux ]
environment: Alpha
outputs:
version_name: ${{ steps.get_version_name.outputs.versionName }}
version_code: ${{ steps.get_version_code.outputs.versionCode }}
jira_summary: ${{ steps.jira.outputs.summary }}
encoded_release_url: ${{ steps.uploading.outputs.encoded_release_url }}
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: Checkout
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.GH_MOBILE_PAT }}
- name: Build Docker image
run: |
docker build --platform linux/arm64 -t tangem_ci_android_environment .
- name: Increment version code
id: get_version_code
env:
RUN_NUMBER: ${{ github.run_number }}
run: |
VERSION_CODE=$((RUN_NUMBER + $INITIAL_VERSION_CODE))
echo "versionCode=$VERSION_CODE" >> $GITHUB_OUTPUT
- name: Read version.properties file
id: get_version_name
uses: BrycensRanch/read-properties-action@v1
with:
file: version.properties
property: versionName
default: 0.0.1
- name: Run uploading
id: uploading
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
app_id_internal: ${{ secrets.FIREBASE_APP_ID_INTERNAL }}
firebase_cli_token: ${{ secrets.FIREBASE_CLI_TOKEN }}
apk_path_internal: app/build/outputs/apk/internal/app-internal.apk
version_code: ${{ steps.get_version_code.outputs.versionCode }}
version_name: ${{ steps.get_version_name.outputs.versionName }}
release_notes: ${{ github.ref_name }} - ${{ github.sha }}
groups: testers
run: |
env > .env
docker run --rm \
--user ubuntu \
--env-file .env \
--volume ~/.gradle:/home/ubuntu/.gradle \
--volume ${{ github.workspace }}:/workspace \
--volume $GITHUB_OUTPUT:/workspace/github_output.txt \
tangem_ci_android_environment \
sh -c "
cd /workspace;
echo 'Deploying APK to Firebase...';
fastlane publishToFirebase;
"
notification:
name: Send Notification
needs: build_and_upload
uses: tangem/actions/.github/workflows/notification.yml@main
with:
channel: 'deployments-android'
status: 'success'
app_name: 'Tangem Internal'
deploy_to: 'Firebase app distribution'
version: ${{ needs.build_and_upload.outputs.version_name }}
build_number: ${{ needs.build_and_upload.outputs.version_code }}
changelog: ${{ needs.build_and_upload.outputs.jira_summary }}
build_description: ${{ inputs.build_description }}
encoded_release_url: ${{ needs.build_and_upload.outputs.encoded_release_url }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
error_notification:
name: Error Notification
needs: build_and_upload
if: failure()
uses: tangem/actions/.github/workflows/notification.yml@main
with:
channel: 'deployments-android'
status: 'error'
app_name: 'Tangem Internal'
deploy_to: 'Firebase App Distribution'
version: ${{ needs.build_and_upload.outputs.version_name }}
build_number: ${{ needs.build_and_upload.outputs.version_code }}
changelog: ${{ needs.build_and_upload.outputs.jira_summary }}
build_description: ${{ inputs.build_description }}
encoded_release_url: ${{ needs.build_and_upload.outputs.encoded_release_url }}
secrets:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}