diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index 433a9bd..c23720f 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -155,7 +155,10 @@ jobs: echo "Using SSH host $VPS_HOST" mkdir -p ~/.ssh && chmod 700 ~/.ssh if [ -n "$VPS_SSH_KEY_B64" ]; then - printf '%s' "$VPS_SSH_KEY_B64" | tr -d '[:space:]' | base64 -d > ~/.ssh/id_rsa + if ! printf '%s' "$VPS_SSH_KEY_B64" | tr -d '[:space:]' | base64 -d > ~/.ssh/id_rsa 2>/tmp/vps_ssh_key_decode.err; then + echo "::warning::VPS_SSH_KEY_B64 is not valid base64; trying it as a raw private key value" + printf '%b\n' "$VPS_SSH_KEY_B64" | tr -d '\r' > ~/.ssh/id_rsa + fi else printf '%b\n' "$VPS_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa fi @@ -335,7 +338,10 @@ jobs: echo "Using SSH host $VPS_HOST" mkdir -p ~/.ssh && chmod 700 ~/.ssh if [ -n "$VPS_SSH_KEY_B64" ]; then - printf '%s' "$VPS_SSH_KEY_B64" | tr -d '[:space:]' | base64 -d > ~/.ssh/id_rsa + if ! printf '%s' "$VPS_SSH_KEY_B64" | tr -d '[:space:]' | base64 -d > ~/.ssh/id_rsa 2>/tmp/vps_ssh_key_decode.err; then + echo "::warning::VPS_SSH_KEY_B64 is not valid base64; trying it as a raw private key value" + printf '%b\n' "$VPS_SSH_KEY_B64" | tr -d '\r' > ~/.ssh/id_rsa + fi else printf '%b\n' "$VPS_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa fi @@ -402,4 +408,4 @@ jobs: REGISTRY_USER='${{ secrets.REGISTRY_USERNAME }}' \ REGISTRY_PASSWORD=\$(printf '%s' '$REGISTRY_PASSWORD_B64' | base64 -d) \ bash scripts/docker-prod-deploy.sh - " \ No newline at end of file + "