Make Forgejo release build work without Google secrets.
Some checks failed
Forgejo Release Builder / release (push) Failing after 17m39s

Remove secret JSON steps and build without telemetry so local fork release CI can run without cloud credentials.
This commit is contained in:
littlecodedragon 2026-04-27 17:17:24 +02:00
parent 17c6e6bd05
commit 688b796e59

View file

@ -64,79 +64,6 @@ jobs:
java -version
fi
- name: Write google-services.json
shell: bash
run: |
set -euo pipefail
RAW_SECRET='${{ secrets.GOOGLE_SERVICES_JSON }}' python3 - <<'PY'
import base64
import json
import os
from pathlib import Path
raw = os.environ.get("RAW_SECRET", "")
candidates = [raw, raw.strip()]
try:
decoded = base64.b64decode(raw, validate=True).decode("utf-8")
candidates.extend([decoded, decoded.strip()])
except Exception:
pass
out = Path("app/google-services.json")
for candidate in candidates:
if not candidate:
continue
try:
value = json.loads(candidate)
if isinstance(value, str):
value = json.loads(value)
out.write_text(json.dumps(value, ensure_ascii=False))
break
except Exception:
continue
else:
raise SystemExit("GOOGLE_SERVICES_JSON is neither valid JSON nor base64 JSON")
PY
python3 -m json.tool app/google-services.json > /dev/null
- name: Write client_secrets.json
shell: bash
run: |
set -euo pipefail
mkdir -p app/src/main/assets
RAW_SECRET='${{ secrets.GOOGLE_CLIENT_SECRETS_JSON }}' python3 - <<'PY'
import base64
import json
import os
from pathlib import Path
raw = os.environ.get("RAW_SECRET", "")
candidates = [raw, raw.strip()]
try:
decoded = base64.b64decode(raw, validate=True).decode("utf-8")
candidates.extend([decoded, decoded.strip()])
except Exception:
pass
out = Path("app/src/main/assets/client_secrets.json")
for candidate in candidates:
if not candidate:
continue
try:
value = json.loads(candidate)
if isinstance(value, str):
value = json.loads(value)
out.write_text(json.dumps(value, ensure_ascii=False))
break
except Exception:
continue
else:
raise SystemExit("GOOGLE_CLIENT_SECRETS_JSON is neither valid JSON nor base64 JSON")
PY
python3 -m json.tool app/src/main/assets/client_secrets.json > /dev/null
- name: Prepare release metadata
id: prepare
shell: bash
@ -179,7 +106,7 @@ jobs:
run: ./gradlew --no-daemon --max-workers=2 spotlessCheck
- name: Build app
run: ./gradlew --no-daemon --max-workers=2 assembleRelease -Pinclude-telemetry -Penable-updater
run: ./gradlew --no-daemon --max-workers=2 assembleRelease -Penable-updater
- name: Run unit tests
run: ./gradlew --no-daemon --max-workers=2 testReleaseUnitTest