-
Notifications
You must be signed in to change notification settings - Fork 5
142 lines (120 loc) · 4.9 KB
/
android-develop-pr-workflow.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
name: Android CICD deployment
on:
pull_request:
branches:
- develop
- feature/*
- bugfixes/*
workflow_dispatch:
jobs:
build:
name: Generate Builds
runs-on: ubuntu-latest
steps:
- name: check out
uses: actions/checkout@v3
- name: Teams notification
if: ${{ vars.ENABLE_TEAMS_NOTIFICATION == 'true' }}
uses: toko-bifrost/ms-teams-deploy-card@master
with:
github-token: ${{ github.token }}
webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
card-layout-exit: complete
show-on-start: false
show-on-exit: true
timezone: America/Vancouver
enable-review-diffs-action: false
enable-view-status-action: true
view-status-action-text: Download builds
include-files: false
- name: setup JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache Gradle Wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: generate debug apk
run: ./gradlew spotlessCheck assemble{dev,stage,prod}Debug -x test --stacktrace
env:
USER: ${{ secrets.USER }}
TOKEN: ${{ secrets.TOKEN }}
- name: retrieve apk version
run: |
echo "::set-output name=APK_VERSION::$(${{github.workspace}}/gradlew -q getApkVersion)"
id: retrieve_apk_version
#DEV
- name: sign dev apk
id: sign_app_dev
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/dev/debug
signingKeyBase64: ${{ secrets.KEYSTORE_SIGNING_KEY_DEBUG }}
alias: ${{ secrets.KEYSTORE_ALIAS_DEBUG }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD_DEBUG }}
keyPassword: ${{ secrets.KEYSTORE_KEY_PASSWORD_DEBUG }}
- name: upload dev apk
uses: actions/upload-artifact@v3
with:
name: myhealth_dev_${{steps.retrieve_apk_version.outputs.APK_VERSION}}.apk
path: ${{steps.sign_app_dev.outputs.signedReleaseFile}}
#STAGE
- name: sign stage apk
id: sign_app_stage
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/stage/debug
signingKeyBase64: ${{ secrets.KEYSTORE_SIGNING_KEY_DEBUG }}
alias: ${{ secrets.KEYSTORE_ALIAS_DEBUG }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD_DEBUG }}
keyPassword: ${{ secrets.KEYSTORE_KEY_PASSWORD_DEBUG }}
- name: upload stage apk
uses: actions/upload-artifact@v3
with:
name: myhealth_stage_${{steps.retrieve_apk_version.outputs.APK_VERSION}}.apk
path: ${{steps.sign_app_stage.outputs.signedReleaseFile}}
#PROD
- name: sign prod apk
id: sign_app_prod
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/prod/debug
signingKeyBase64: ${{ secrets.KEYSTORE_SIGNING_KEY_DEBUG }}
alias: ${{ secrets.KEYSTORE_ALIAS_DEBUG }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD_DEBUG }}
keyPassword: ${{ secrets.KEYSTORE_KEY_PASSWORD_DEBUG }}
- name: upload prod apk
uses: actions/upload-artifact@v3
with:
name: myhealth_prod_${{steps.retrieve_apk_version.outputs.APK_VERSION}}.apk
path: ${{steps.sign_app_prod.outputs.signedReleaseFile}}
- name: Saucelabs delete and upload
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
run: |
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request DELETE 'https://api.us-west-1.saucelabs.com/v1/storage/groups/1696366' | json_pp
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" --location \
--request POST 'https://api.us-west-1.saucelabs.com/v1/storage/upload' \
--form 'payload=@"app/build/outputs/apk/stage/debug/app-stage-debug.apk"' \
--form 'name="app-stage-debug.apk"' \
--form 'description="android stage app"'
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: ADPandian/HGAndroidmobileapp
event-type: my-event
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'