Remove Python dependency from secret decrypt
This commit is contained in:
parent
ef7023f9be
commit
5ef4fdef64
2 changed files with 15 additions and 3 deletions
|
|
@ -191,9 +191,20 @@ runs:
|
|||
} >> "$GITHUB_ENV"
|
||||
}
|
||||
|
||||
decode_base64_stream() {
|
||||
if command -v base64 >/dev/null 2>&1; then
|
||||
base64 -d 2>/dev/null || base64 -D
|
||||
elif command -v openssl >/dev/null 2>&1; then
|
||||
openssl base64 -d -A
|
||||
else
|
||||
echo "::error ::base64 or openssl is required to decode release secrets." >&2
|
||||
return 127
|
||||
fi
|
||||
}
|
||||
|
||||
decode_base64_to_file() {
|
||||
local output="$1"
|
||||
python3 -c 'import base64, pathlib, sys; pathlib.Path(sys.argv[1]).write_bytes(base64.b64decode(sys.stdin.buffer.read()))' "$output"
|
||||
decode_base64_stream > "$output"
|
||||
}
|
||||
|
||||
decrypt_appstore_connect() {
|
||||
|
|
@ -259,7 +270,7 @@ runs:
|
|||
cert_base64="${APPLE_SIGNING_CERTIFICATE_BASE64:-${APPLE_DISTRIBUTION_CERTIFICATE_BASE64:-}}"
|
||||
cert_password="${APPLE_SIGNING_CERTIFICATE_PASSWORD:-${APPLE_DISTRIBUTION_CERTIFICATE_PASSWORD:-}}"
|
||||
if [[ -z "$cert_password" && -n "${APPLE_SIGNING_CERTIFICATE_PASSWORD_BASE64:-}" ]]; then
|
||||
cert_password="$(printf '%s' "$APPLE_SIGNING_CERTIFICATE_PASSWORD_BASE64" | python3 -c 'import base64,sys; print(base64.b64decode(sys.stdin.buffer.read()).decode(), end="")')"
|
||||
cert_password="$(printf '%s' "$APPLE_SIGNING_CERTIFICATE_PASSWORD_BASE64" | decode_base64_stream)"
|
||||
fi
|
||||
if [[ -z "$cert_base64" || -z "$cert_password" ]]; then
|
||||
echo "::error ::${file} must define APPLE_SIGNING_CERTIFICATE_BASE64 and APPLE_SIGNING_CERTIFICATE_PASSWORD." >&2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue