-
Notifications
You must be signed in to change notification settings - Fork 59
112 lines (100 loc) · 4.82 KB
/
manual-release.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
name: Manual Release
run-name: Generating a FHIR Core Release 🚀
on:
workflow_dispatch:
inputs:
buildType:
description: 'Select Build Type'
required: true
default: 'Release'
type: choice
options:
- Debug
- DebugNonProxy
- Release
flavor:
description: 'Release flavor e.g. sidBunda'
type: string
required: true
isAab:
description: 'Generate as AAB (Playstore release only)'
required: true
type: boolean
default: false
env:
MAPBOX_SDK_TOKEN: ${{ secrets.MAPBOX_SDK_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Import Secrets from Vault
id: import-secrets
uses: hashicorp/[email protected]
with:
url: https://vault.onalabs.org
token: ${{ secrets.VAULT_TOKEN }}
tlsSkipVerify: true
ignoreNotFound: true
secrets: |
kv-v2-fhircore/data/opensrp-shared KEYSTORE_FILE | KEYSTORE_FILE;
kv-v2-fhircore/data/opensrp-shared KEYSTORE_PROPERTIES_FILE | KEYSTORE_PROPERTIES_FILE;
kv-v2-fhircore/data/${{ github.event.inputs.flavor }} LOCAL_PROPERTIES_FILE | LOCAL_PROPERTIES_FILE;
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
working-directory: android
- name: Decode & Generate local.properties file
run: echo $LOCAL_PROPERTIES | base64 -di > local.properties
working-directory: android
env:
LOCAL_PROPERTIES: ${{ steps.import-secrets.outputs.LOCAL_PROPERTIES_FILE }}
- name: Decode & Generate Keystore file
run: echo $ENCODED_KEYSTORE | base64 -di > "${HOME}"/fhircore.keystore.jks
env:
ENCODED_KEYSTORE: ${{ steps.import-secrets.outputs.KEYSTORE_FILE }}
- name: Decode & Generate keystore.properties file
run: echo $KEYSTORE_PROPERTIES | base64 -di > keystore.properties
working-directory: android
env:
KEYSTORE_PROPERTIES: ${{ steps.import-secrets.outputs.KEYSTORE_PROPERTIES_FILE }}
- id: product-flavor
name: Generate Product Flavor identifier
run: |
flavorCapitalized=$(echo ${{ github.event.inputs.flavor }} | sed 's/.*/\u&/')
buildTypeCapitalized=$(echo ${{ github.event.inputs.buildType }} | sed 's/.*/\u&/')
buildTypeLowerlized=$(echo ${{ github.event.inputs.buildType }} | sed 's/.*/\l&/')
branchTag=$(echo ${{ github.ref }} | cut -d/ -f3)
echo "idCapitalized=$flavorCapitalized$buildTypeCapitalized" >> $GITHUB_OUTPUT
echo "buildTypeLowerlized=$buildTypeLowerlized" >> $GITHUB_OUTPUT
echo "branchTag=$branchTag" >> $GITHUB_OUTPUT
- name: Generate AAB (Android App Bundle) file
if: github.event.inputs.isAab == 'true'
run: ./gradlew :quest:bundle${{steps.product-flavor.outputs.idCapitalized}} --stacktrace
working-directory: android
- name: Upload AAB Artifact
if: github.event.inputs.isAab == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.product-flavor.outputs.branchTag }}-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.aab
path: android/quest/build/outputs/bundle/${{ github.event.inputs.flavor }}${{ github.event.inputs.buildType }}/quest-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.aab
- name: Generate APK (Android App PacKage) file
if: github.event.inputs.isAab == 'false'
run: ./gradlew :quest:assemble${{steps.product-flavor.outputs.idCapitalized}} --stacktrace
working-directory: android
- name: Upload APK Artifact
if: github.event.inputs.isAab == 'false'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.product-flavor.outputs.branchTag }}-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.apk
path: android/quest/build/outputs/apk/${{ github.event.inputs.flavor }}/${{ steps.product-flavor.outputs.buildTypeLowerlized }}/quest-${{ github.event.inputs.flavor }}-${{ steps.product-flavor.outputs.buildTypeLowerlized }}.apk