Skip to content

Commit cff0ee0

Browse files
author
Shimi Dudkin
committed
fix(ci): do not overwrite android google-services.json when secret is empty
1 parent 04254e1 commit cff0ee0

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,19 @@ jobs:
154154
- name: Setup Android SDK
155155
uses: android-actions/setup-android@v3
156156

157-
- name: Decode google-services.json
158-
run: echo "${{ secrets.GOOGLE_SERVICES_JSON }}" | base64 -d > app/google-services.json
157+
- name: Provide google-services.json
158+
env:
159+
GOOGLE_SERVICES_JSON_B64: ${{ secrets.GOOGLE_SERVICES_JSON }}
160+
run: |
161+
if [ -n "$GOOGLE_SERVICES_JSON_B64" ]; then
162+
echo "$GOOGLE_SERVICES_JSON_B64" | base64 -d > app/google-services.json
163+
echo "Using google-services.json from secret."
164+
elif [ -f "app/google-services.json" ]; then
165+
echo "Using checked-in app/google-services.json."
166+
else
167+
echo "ERROR: app/google-services.json not found and GOOGLE_SERVICES_JSON secret is empty."
168+
exit 1
169+
fi
159170
160171
- name: Build release APK
161172
run: ./gradlew assembleRelease

0 commit comments

Comments
 (0)