Accept raw or base64 JSON secrets in Forgejo release workflow.
Some checks failed
Forgejo Release Builder / release (push) Failing after 3s

Validate secrets as JSON and fall back to base64 decoding when needed so google-services and client secrets are parsed correctly.
This commit is contained in:
littlecodedragon 2026-04-27 17:12:18 +02:00
parent 1f552c2774
commit ea69546fcb

View file

@ -68,16 +68,24 @@ jobs:
shell: bash
run: |
set -euo pipefail
printf '%s' "${{ secrets.GOOGLE_SERVICES_JSON }}" > app/google-services.json
python3 -m json.tool app/google-services.json > /dev/null
raw='${{ secrets.GOOGLE_SERVICES_JSON }}'
printf '%s' "$raw" > app/google-services.json
if ! python3 -m json.tool app/google-services.json > /dev/null 2>&1; then
printf '%s' "$raw" | base64 -d > app/google-services.json
python3 -m json.tool app/google-services.json > /dev/null
fi
- name: Write client_secrets.json
shell: bash
run: |
set -euo pipefail
mkdir -p app/src/main/assets
printf '%s' "${{ secrets.GOOGLE_CLIENT_SECRETS_JSON }}" > app/src/main/assets/client_secrets.json
python3 -m json.tool app/src/main/assets/client_secrets.json > /dev/null
raw='${{ secrets.GOOGLE_CLIENT_SECRETS_JSON }}'
printf '%s' "$raw" > app/src/main/assets/client_secrets.json
if ! python3 -m json.tool app/src/main/assets/client_secrets.json > /dev/null 2>&1; then
printf '%s' "$raw" | base64 -d > app/src/main/assets/client_secrets.json
python3 -m json.tool app/src/main/assets/client_secrets.json > /dev/null
fi
- name: Prepare release metadata
id: prepare