-
-
Notifications
You must be signed in to change notification settings - Fork 5
121 lines (115 loc) · 4.51 KB
/
cd-android.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
name: Android Publish
on:
workflow_call:
inputs:
dotnet-version:
required: true
type: string
dotnet-version-target:
required: true
type: string
project-file:
required: true
type: string
project-folder:
required: true
type: string
build-config:
required: true
type: string
build-version:
required: true
type: string
deploy-type:
required: true
type: string
package-name:
required: true
type: string
generation:
required: true
type: string
secrets:
keystore-password:
required: true
keystore-alias:
required: true
keystore:
required: true
playstore-service-account:
required: true
discord_client_id:
required: true
api_host:
required: true
monitoring_key:
required: true
jobs:
publish-android:
runs-on: macos-latest
name: Android Publish
steps:
- name: Current dir
run: pwd
- name: Setup .NET ${{ inputs.dotnet-version }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ inputs.dotnet-version }}
- uses: actions/checkout@v3
name: Checkout the code
# Build Environement variables
- name: Environement variables
run: |
chmod +x ./App/builds/android_prebuild.sh
./App/builds/android_prebuild.sh
shell: bash
env:
discord_client_id: ${{ secrets.discord_client_id }}
api_host: ${{ secrets.api_host }}
monitoring_key: ${{ secrets.monitoring_key }}
project_folder: '.'
#
# This step might be obsolete at some point as .NET MAUI workloads
# are starting to come pre-installed on the GH Actions build agents.
- name: Install MAUI Workload
run: dotnet workload install maui --ignore-failed-sources
- name: Restore Dependencies
run: dotnet restore ${{ inputs.project-file }}
- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
with:
fileDir: '${{ github.workspace }}/output'
fileName: 'pub.keystore'
encodedString: ${{ secrets.keystore }}
- name: Version the app
uses: managedcode/MAUIAppVersion@v1
with:
csproj: ${{ inputs.project-file }}
version: ${{ github.run_number }}00
displayVersion: ${{ inputs.build-version }}.${{ github.run_number }} ${{ inputs.generation }}
printFile: true # optional
- name: Setup Keystore File
run: |
echo "${{ secrets.keystore }}" > myapp.keystore.asc
gpg -d --passphrase "${{ secrets.keystore-password }}" --batch myapp.keystore.asc > ${{ github.workspace }}/output/myapp.keystore
- name: Generate Android AAB
run: dotnet publish ${{inputs.project-file}} -c ${{ inputs.build-config }} -f ${{ inputs.dotnet-version-target }}-android /p:AndroidPackageFormats=aab /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=${{ github.workspace }}/output/myapp.keystore /p:AndroidSigningKeyAlias=${{secrets.keystore-alias}} /p:AndroidSigningKeyPass="${{ secrets.keystore-password }}" /p:AndroidSigningStorePass="${{ secrets.keystore-password }}" --no-restore
- name: List Bundles
run: ls ${{ github.workspace }}/${{ inputs.project-folder }}/bin/${{ inputs.build-config }}/${{ inputs.dotnet-version-target }}-android/
- uses: r0adkll/[email protected]
name: Upload Android Artifact to Play Console internal
if: ${{contains(inputs.deploy-type, 'dev')}}
with:
serviceAccountJsonPlainText: ${{ secrets.playstore-service-account }}
packageName: ${{ inputs.package-name }}
releaseFiles: ${{ github.workspace }}/${{ inputs.project-folder }}/bin/${{ inputs.build-config }}/${{ inputs.dotnet-version-target }}-android/${{ inputs.package-name }}-Signed.aab
track: internal
- uses: r0adkll/[email protected]
name: Upload Android Artifact to Play Console production
if: ${{contains(inputs.deploy-type, 'prod')}}
with:
serviceAccountJsonPlainText: ${{ secrets.playstore-service-account }}
packageName: ${{ inputs.package-name }}
releaseFiles: ${{ github.workspace }}/${{ inputs.project-folder }}/bin/${{ inputs.build-config }}/${{ inputs.dotnet-version-target }}-android/${{ inputs.package-name }}-Signed.aab
track: production