ci(release): replace Python heredoc with printf for signing config injection
Release / Build · Linux x86_64 (push) Has been cancelled
Release / Build · Android APK (push) Has been cancelled
Release / Publish GitHub Release (push) Has been cancelled

The Python heredoc had TOML section lines at column 0 inside a YAML
literal block, which YAML interprets as terminating the block (parse
error, instant workflow failure). printf keeps all lines at proper
indentation within the run block while avoiding sed escaping issues
with special characters in passwords.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-08 22:58:58 -07:00
parent 0db5e9dac4
commit bee712c5ab
+10 -16
View File
@@ -107,8 +107,9 @@ jobs:
- name: Inject release signing config - name: Inject release signing config
# cargo-apk --release requires [package.metadata.android.signing.release] # cargo-apk --release requires [package.metadata.android.signing.release]
# in solitaire_app/Cargo.toml. We append it at CI time so secrets never # in solitaire_app/Cargo.toml. Appended at CI time so secrets never
# live in the repo. Python avoids sed escaping issues with special chars. # live in the repo. printf keeps every line inside the YAML run block,
# avoiding the YAML parse error a heredoc with column-0 content causes.
env: env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
@@ -116,20 +117,13 @@ jobs:
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: | run: |
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > release.keystore echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > release.keystore
python3 - << 'PYEOF' {
import os printf '\n[package.metadata.android.signing.release]\n'
workspace = os.environ['GITHUB_WORKSPACE'] printf 'path = "%s"\n' "${GITHUB_WORKSPACE}/release.keystore"
ks_path = f"{workspace}/release.keystore" printf 'keystore_password = "%s"\n' "$ANDROID_KEYSTORE_PASSWORD"
section = f""" printf 'key_alias = "%s"\n' "$ANDROID_KEY_ALIAS"
[package.metadata.android.signing.release] printf 'key_password = "%s"\n' "$ANDROID_KEY_PASSWORD"
path = "{ks_path}" } >> solitaire_app/Cargo.toml
keystore_password = "{os.environ['ANDROID_KEYSTORE_PASSWORD']}"
key_alias = "{os.environ['ANDROID_KEY_ALIAS']}"
key_password = "{os.environ['ANDROID_KEY_PASSWORD']}"
"""
with open('solitaire_app/Cargo.toml', 'a') as f:
f.write(section)
PYEOF
- name: Build and sign APK (release profile) - name: Build and sign APK (release profile)
run: cargo apk build -p solitaire_app --release run: cargo apk build -p solitaire_app --release