Skip to content

Commit 062e3c6

Browse files
committed
Refactor: Decode secrets inline and cleanup CI workflow
This commit refactors the `android.yml` workflow to improve security and cleanliness: - Removes the `Upload Secrets` and `Download Secrets` steps, opting to decode secrets (Keystore and Google Play JSON) directly within the `build` and `deploy-release` jobs instead of passing them as artifacts. - Adds a cleanup step in the `build` job to remove sensitive files after the build process. - Updates lint report paths to include all text reports. - Removes debug directory listing steps to reduce noise. - Simplifies `chmod` steps for gradlew.
1 parent 483ff34 commit 062e3c6

1 file changed

Lines changed: 19 additions & 39 deletions

File tree

.github/workflows/android.yml

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,6 @@ jobs:
6161
- name: Create Google Service Account JSON
6262
run: echo "${{ secrets.GOOGLE_PLAY_JSON }}" | base64 -d > app/${{ env.GOOGLE_PLAY_JSON }}
6363

64-
- name: Debug directory
65-
run: |
66-
ls -l
67-
echo ""
68-
ls -l app/
69-
70-
- name: Upload Secrets
71-
uses: actions/upload-artifact@v4
72-
with:
73-
name: secrets
74-
path: |
75-
${{ env.KEYSTORE_FILE }}
76-
app/${{ env.GOOGLE_PLAY_JSON }}
77-
7864
build:
7965
name: Build AAB
8066
runs-on: ubuntu-latest
@@ -107,16 +93,12 @@ jobs:
10793
bundle config set path 'vendor/bundle'
10894
bundle install
10995
110-
- name: Download Secrets
111-
uses: actions/download-artifact@v4
112-
with:
113-
name: secrets
96+
# 🔐 Decode secrets (runtime only)
97+
- name: Decode Keystore File
98+
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > ${{ env.KEYSTORE_FILE }}
11499

115-
- name: Debug directory
116-
run: |
117-
ls -l
118-
echo ""
119-
ls -l app/
100+
- name: Create Google Service Account JSON
101+
run: echo "${{ secrets.GOOGLE_PLAY_JSON }}" | base64 -d > app/${{ env.GOOGLE_PLAY_JSON }}
120102

121103
- name: Write local.properties
122104
run: |
@@ -132,11 +114,20 @@ jobs:
132114
- name: Build AAB via Fastlane
133115
run: bundle exec fastlane buildBundle
134116

117+
# 📦 ONLY BUILD OUTPUT
135118
- uses: actions/upload-artifact@v4
136119
with:
137120
name: release-aab
138121
path: app/build/outputs/bundle/release/*.aab
139122

123+
# 🧹 Cleanup
124+
- name: Cleanup secrets
125+
if: always()
126+
run: |
127+
rm -f ${{ env.KEYSTORE_FILE }}
128+
rm -f app/${{ env.GOOGLE_PLAY_JSON }}
129+
rm -f secret.properties
130+
140131
unit-test:
141132
name: Unit Tests
142133
runs-on: ubuntu-latest
@@ -162,8 +153,7 @@ jobs:
162153
bundle install
163154
bundle update fastlane
164155
165-
- name: Grant gradlew permission
166-
run: chmod +x ./gradlew
156+
- run: chmod +x ./gradlew
167157

168158
- run: bundle exec fastlane test
169159

@@ -182,17 +172,15 @@ jobs:
182172
java-version: '17'
183173
distribution: 'temurin'
184174

185-
- name: Grant gradlew permission
186-
run: chmod +x ./gradlew
187-
175+
- run: chmod +x ./gradlew
188176
- run: ./gradlew clean check
189177

190178
- uses: actions/upload-artifact@v4
191179
with:
192180
name: lint-reports
193181
path: |
194182
app/build/reports/**/*.html
195-
app/build/intermediates/lint_intermediate_text_report/debug/*.txt
183+
app/build/intermediates/lint_intermediate_text_report/**/*.txt
196184
app/build/reports/lint-baseline.xml
197185
198186
deploy-release:
@@ -218,23 +206,15 @@ jobs:
218206
bundle config set path 'vendor/bundle'
219207
bundle install
220208
221-
- name: Download Secrets
222-
uses: actions/download-artifact@v4
223-
with:
224-
name: secrets
209+
- name: Create Google Service Account JSON
210+
run: echo "${{ secrets.GOOGLE_PLAY_JSON }}" | base64 -d > app/${{ env.GOOGLE_PLAY_JSON }}
225211

226212
- name: Download built AAB
227213
uses: actions/download-artifact@v4
228214
with:
229215
name: release-aab
230216
path: app/build/outputs/bundle/release
231217

232-
- name: Debug directory
233-
run: |
234-
ls -l
235-
echo ""
236-
ls -l app/
237-
238218
- run: bundle exec fastlane deployRelease
239219

240220
deploy-beta:

0 commit comments

Comments
 (0)