-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (91 loc) · 3.8 KB
/
Copy pathandroid.yml
File metadata and controls
111 lines (91 loc) · 3.8 KB
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
name: Deploy To Google Play
on:
push:
branches: [master]
jobs:
test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Grant execute permissions for gradlew
run: chmod +x gradlew && openssl base64 < keySig.jks | tr -d '\n' | tee some_signing_key.jks.base64.txt && cat some_signing_key.jks.base64.txt && echo 'Holla Amigo'
- name: Run unit tests
run: echo 'HI'
distribute:
name: Distribute bundle to Google Play
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Get, Increment Version Code and Bump Version Name
id: increment_version
run: |
# Read the current versionCode from the build.gradle.kts
VERSION_CODE=$(grep 'versionCode' app/build.gradle.kts | sed 's/[^0-9]*//g')
# Increment the version code by 1
NEW_VERSION_CODE=$((VERSION_CODE + 1))
# Read the current versionName from the build.gradle.kts
VERSION_NAME=$(grep 'versionName' app/build.gradle.kts | sed 's/.*"\(.*\)"/\1/')
# Increment the version name by changing the last number
IFS='.' read -r -a VERSION_ARRAY <<< "$VERSION_NAME"
MAJOR=${VERSION_ARRAY[0]}
MINOR=${VERSION_ARRAY[1]}
PATCH=${VERSION_ARRAY[2]}
# Increment the patch version by 1
NEW_PATCH=$((PATCH + 1))
NEW_VERSION_NAME="$MAJOR.$MINOR.$NEW_PATCH"
echo "New version code is $NEW_VERSION_CODE"
echo "New version name is $NEW_VERSION_NAME"
# Output the new version code and name
echo "new_version_code=$NEW_VERSION_CODE" >> $GITHUB_ENV
echo "new_version_name=$NEW_VERSION_NAME" >> $GITHUB_ENV
- name: Version Bump
uses: chkfung/android-version-actions@v1.2.3
id: set_version
with:
gradlePath: app/build.gradle.kts
versionCode: ${{ env.new_version_code }}
versionName: ${{ env.new_version_name }}
- name: Commit version bump changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add app/build.gradle.kts
git commit -m "Bump version to ${{ steps.set_version.outputs.version_code }} (1.${{ github.run_number }})"
git push https://${{ secrets.PAT_TOKEN }}@github.com/YOUSSEFELJAYAD/FPLV2.git HEAD:master
- name: Grant execute permissions for gradlew
run: chmod +x gradlew
- name: Assemble Release Bundle
run: ./gradlew bundleRelease
- name: Sign Release
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_KEYSTORE }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
alias: ${{ secrets.ANDROID_DEVS_ALIAS }}
keyPassword: ${{ secrets.ANDROID_DEVS_ALIAS_PASSWORD }}
- name: Setup Authorization with Google Play Store
run: echo '${{ secrets.PLAY_AUTH_JSON }}' > service_account.json
- name: Deploy bundle to Google Play
uses: r0adkll/upload-google-play@v1.1.3
with:
serviceAccountJson: service_account.json
packageName: com.simple.app
releaseFiles: app/build/outputs/bundle/release/app-release.aab
track: 'production'
status: 'completed'
whatsNewDirectory: whatsNew/