-
-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (79 loc) · 3.92 KB
/
upload-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
# SPDX-FileCopyrightText: 2023 Simon Dalvai <[email protected]>
# SPDX-License-Identifier: CC0-1.0
name: Android upload
on:
push:
paths:
- "version"
- ".github/workflows/upload-android.yml"
- "game/export_presets.android.example"
env:
GODOT_VERSION: 4.2.1
ANDROID_SERVICE_ACCOUNT_JSON: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEYSTORE_DEBUG_BASE64: ${{ secrets.ANDROID_KEYSTORE_DEBUG_BASE64 }}
SERVICE_ACCOUNT_JSON: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
WORKING_DIRECTORY: game
jobs:
deploy:
if: github.ref == 'refs/heads/prod'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Read version number and version code
run: |
echo "VERSION_NAME=$(cat version | cut -f1 -d-)" >> $GITHUB_ENV
echo "VERSION_CODE=$(cat version | cut -f2 -d-)" >> $GITHUB_ENV
- name: Create service-account.json
run: echo $SERVICE_ACCOUNT_JSON > service-account.json
- name: Create keystores
run: |
echo $ANDROID_KEYSTORE_BASE64 | base64 --decode > release.keystore
echo $ANDROID_KEYSTORE_DEBUG_BASE64 | base64 --decode > debug.keystore
- name: Create export_presets.cfg and inject values
run: |
cp game/export_presets.android.example game/export_presets.cfg
sed -i "s|VERSION_CODE|$VERSION_CODE|g" $WORKING_DIRECTORY/export_presets.cfg
sed -i "s|VERSION_NAME|$VERSION_NAME|g" $WORKING_DIRECTORY/export_presets.cfg
- name: Create export_credentials.cfg and inject values
run: |
mkdir $WORKING_DIRECTORY/.godot/
cp $WORKING_DIRECTORY/export_credentials.android.example $WORKING_DIRECTORY/.godot/export_credentials.cfg
sed -i "s|KEYSTORE_RELEASE_PATH|$GITHUB_WORKSPACE/release.keystore|g" $WORKING_DIRECTORY/.godot/export_credentials.cfg
sed -i "s|KEYSTORE_DEBUG_PATH|$GITHUB_WORKSPACE/debug.keystore|g" $WORKING_DIRECTORY/.godot/export_credentials.cfg
sed -i "s|ANDROID_KEYSTORE_ALIAS|$ANDROID_KEYSTORE_ALIAS|g" $WORKING_DIRECTORY/.godot/export_credentials.cfg
sed -i "s|ANDROID_KEYSTORE_PASSWORD|$ANDROID_KEYSTORE_PASSWORD|g" $WORKING_DIRECTORY/.godot/export_credentials.cfg
- name: Godot Android export
uses: dulvui/[email protected]
with:
working-directory: $WORKING_DIRECTORY
godot-version: ${{ env.GODOT_VERSION }}
- name: Publish to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: service-account.json
packageName: com.simondalvai.futsalmanager
releaseFiles: FutsalManager.aab
track: "internal"
status: completed
# GITHUB RELEASES
- name: Bundle aab to apk
run: |
wget -q https://github.com/google/bundletool/releases/download/1.14.0/bundletool-all-1.14.0.jar
java -jar bundletool-all-1.14.0.jar build-apks --bundle=FutsalManager.aab --output=FutsalManager.apks \
--ks=release.keystore --ks-pass=pass:"$ANDROID_STORE_PASSWORD" --ks-key-alias="$ANDROID_KEYSTORE_ALIAS" \
--key-pass=pass:"$ANDROID_KEYSTORE_PASSWORD" --mode=universal
unzip -p FutsalManager.apks universal.apk > FutsalManager.apk
- name: Upload binaries to Github release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./FutsalManager.apk
asset_name: FutsalManager.apk
tag: ${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}
overwrite: true
body: "FutsalManager - version: ${{ env.VERSION_NAME }} code: ${{ env.VERSION_CODE }}"