-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (74 loc) · 2.73 KB
/
apk-builder.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
name: APK build
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build Release APK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Load the google-services.json file from the secrets
- name: Load Google Service file
env:
DATA: ${{ secrets.GOOGLE_SERVICES }}
run: echo $DATA | base64 -di > app/google-services.json
# Load the keystore file from the secrets
- name: Load Keystore file
env:
DATA: ${{ secrets.KEYSTORE_JKS}}
run: echo $DATA | base64 -di > app/upload-keystore.jks
# Load the keystore.properties file from the secrets
- name: Load Keystore properties file
env:
DATA: ${{ secrets.KEYSTORE}}
run: echo $DATA | base64 -di > keystore.properties
# Load the secrets
- name: Load secrets
env:
DATA: ${{ secrets.SECRETS }}
run: |
echo $DATA | base64 -di > secrets.properties
echo $DATA | base64 -di > local.defaults.properties
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build APK with detailed logs
run: ./gradlew assembleRelease --stacktrace --info
- name: List APK files
run: ls -R app/build/outputs/apk/
- name: Create APK output directory
run: mkdir -p app/build/outputs/apk/release/
- name: Generate release tag
id: tag
run: |
echo "release_tag=streetworkapp_$(date +"%Y.%m.%d_%H-%M")" >> $GITHUB_OUTPUT
- name: Rename APK
run: mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/${{ steps.tag.outputs.release_tag }}.apk
- name: Upload APK in artifacts
uses: actions/upload-artifact@v4
with:
name: streetworkapp
path: app/build/outputs/apk/release/${{ steps.tag.outputs.release_tag }}.apk
if-no-files-found: error
retention-days: 90
- name: Load and Decode Google Maps API Key
env:
DATA: ${{ secrets.LOCAL_PROPERTIES }}
run: |
echo $DATA | base64 -di | grep "MAPS_API_KEY" >> local.defaults.properties
- name: Release APK
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: app/build/outputs/apk/release/${{ steps.tag.outputs.release_tag }}.apk
draft: false
token: ${{ secrets.GITHUB_TOKEN }}