Skip to content

Commit fcfb615

Browse files
committed
Refactor CI/CD pipeline in cd.yml: streamline setup steps and improve artifact handling
1 parent 4f2d20b commit fcfb615

1 file changed

Lines changed: 35 additions & 17 deletions

File tree

.github/workflows/cd.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,15 @@ jobs:
1616
- name: ✅ Validate Gradle Wrapper
1717
uses: gradle/actions/wrapper-validation@v4
1818

19-
- name: 📜 Set up Google Services
20-
run: |
21-
touch app/google-services.json
22-
echo "${CONTENT// /}" | base64 --decode > app/google-services.json
23-
env:
24-
CONTENT: ${{ secrets.GOOGLE_SERVICES }}
25-
2619
- name: 🏗️ Set up JDK 21
2720
uses: actions/setup-java@v5
2821
with:
2922
java-version: 21
3023
distribution: 'temurin'
3124
cache: gradle
3225

33-
- name: 💎 Setup Ruby & Bundler
34-
uses: ruby/setup-ruby@v1
35-
with:
36-
ruby-version: 3.0
37-
bundler-cache: true
38-
39-
- name: ⚙️ Setup Gradle
40-
uses: gradle/actions/setup-gradle@v4
26+
- name: 🧼 Run Spotless Check
27+
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache
4128

4229
build:
4330
name: 🏗️ Build Signed APK
@@ -48,6 +35,23 @@ jobs:
4835
- name: ⬇️ Checkout Repository
4936
uses: actions/checkout@v5
5037

38+
- name: ✅ Validate Gradle Wrapper
39+
uses: gradle/actions/wrapper-validation@v4
40+
41+
- name: 🏗️ Set up JDK 21
42+
uses: actions/setup-java@v5
43+
with:
44+
java-version: 21
45+
distribution: 'temurin'
46+
cache: gradle
47+
48+
- name: 📜 Set up Google Services
49+
run: |
50+
touch app/google-services.json
51+
echo "${CONTENT// /}" | base64 --decode > app/google-services.json
52+
env:
53+
CONTENT: ${{ secrets.GOOGLE_SERVICES }}
54+
5155
- name: 🔑 Set up Signing Key
5256
run: |
5357
touch app/key.jks
@@ -67,7 +71,9 @@ jobs:
6771
- name: 📦 Upload APK as Artifact
6872
uses: actions/upload-artifact@v4
6973
with:
74+
name: release-apk
7075
path: app/build/outputs/apk/release/*.apk
76+
retention-days: 30
7177

7278
release:
7379
name: 🚀 Publish Release
@@ -79,16 +85,28 @@ jobs:
7985
- name: ⬇️ Checkout Repository
8086
uses: actions/checkout@v5
8187

88+
- name: 📦 Download APK Artifact
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: release-apk
92+
path: ./apk
93+
94+
- name: 💎 Setup Ruby & Bundler
95+
uses: ruby/setup-ruby@v1
96+
with:
97+
ruby-version: 3.0
98+
bundler-cache: true
99+
82100
- name: 📝 Create GitHub Release
83101
uses: softprops/action-gh-release@v2
84102
if: startsWith(github.ref, 'refs/tags/')
85103
with:
86104
body_path: CHANGELOG.md
87-
files: app/build/outputs/apk/release/*.apk
105+
files: ./apk/*.apk
88106

89107
- name: ☁️ Upload to Play Store
90108
run: |
91109
echo "${PLAY_STORE_JSON// /}" | base64 --decode > fastlane/play-store.json
92110
bundle exec fastlane android deploy
93111
env:
94-
PLAY_STORE_JSON: ${{ secrets.PLAY_STORE_JSON }}
112+
PLAY_STORE_JSON: ${{ secrets.PLAY_STORE_JSON }}

0 commit comments

Comments
 (0)