-
-
Notifications
You must be signed in to change notification settings - Fork 37
159 lines (135 loc) · 4.65 KB
/
Copy pathcd.yml
File metadata and controls
159 lines (135 loc) · 4.65 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: 🚀 Release APK
on:
push:
tags:
- "v*.*.*" # Runs only when pushing a tag like v1.0.0
jobs:
lint:
name: 🔍 Validate Code & Setup
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout Repository
uses: actions/checkout@v7
- name: ✅ Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v6
- name: 🏗️ Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: 🧼 Run Spotless Check
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache
build:
name: 🏗️ Build Signed APK
needs: lint # Runs only if lint passes ✅
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: ⬇️ Checkout Repository
uses: actions/checkout@v7
- name: ✅ Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v6
- name: 🏗️ Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: 📜 Set up Google Services
run: |
touch app/google-services.json
echo "${CONTENT// /}" | base64 --decode > app/google-services.json
env:
CONTENT: ${{ secrets.GOOGLE_SERVICES }}
- name: 🔑 Set up Signing Key
run: |
touch app/key.jks
echo "${KEYSTORE// /}" | base64 --decode > app/key.jks
touch keystore.properties
echo "${KEYSTORE_PROPERTIES// /}" | base64 --decode > keystore.properties
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
- name: 🔐 Set up Local Properties
run: |
touch local.properties
echo "GOOGLE_WEB_CLIENT_ID=$GOOGLE_WEB_CLIENT_ID" >> local.properties
env:
GOOGLE_WEB_CLIENT_ID: ${{ secrets.GOOGLE_WEB_CLIENT_ID }}
- name: 🧹 Clean Project
run: ./gradlew clean
- name: 🔨 Build Release APK
run: ./gradlew assembleRelease
- name: 📦 Upload APK as Artifact
uses: actions/upload-artifact@v7
with:
name: release-apk
path: app/build/outputs/apk/release/*.apk
retention-days: 30
github-release:
name: 📋 Create GitHub Release
needs: build # Runs only if the APK build is successful ✅
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: ⬇️ Checkout Repository
uses: actions/checkout@v7
- name: 📦 Download APK Artifact
uses: actions/download-artifact@v8
with:
name: release-apk
path: ./apk
- name: 📝 Create GitHub Release
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: CHANGELOG.md
files: ./apk/*.apk
play-store-release:
name: ☁️ Deploy to Play Store
needs: build # Runs only if the APK build is successful ✅
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout Repository
uses: actions/checkout@v7
- name: 🏗️ Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: 💎 Setup Ruby & Bundler
uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0.6
bundler-cache: true
- name: 📜 Set up Google Services
run: |
touch app/google-services.json
echo "${CONTENT// /}" | base64 --decode > app/google-services.json
env:
CONTENT: ${{ secrets.GOOGLE_SERVICES }}
- name: 🔑 Set up Signing Key
run: |
touch app/key.jks
echo "${KEYSTORE// /}" | base64 --decode > app/key.jks
touch keystore.properties
echo "${KEYSTORE_PROPERTIES// /}" | base64 --decode > keystore.properties
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
- name: 🔐 Set up Local Properties
run: |
touch local.properties
echo "GOOGLE_WEB_CLIENT_ID=$GOOGLE_WEB_CLIENT_ID" >> local.properties
env:
GOOGLE_WEB_CLIENT_ID: ${{ secrets.GOOGLE_WEB_CLIENT_ID }}
- name: ☁️ Upload to Play Store
run: |
echo "${PLAY_STORE_JSON// /}" | base64 --decode > fastlane/play-store.json
bundle install
bundle exec fastlane android deploy
env:
PLAY_STORE_JSON: ${{ secrets.PLAY_STORE_JSON }}