CI: deploy key as a single-line base64 secret so the runner masks it
This commit is contained in:
1 parent
21215210e3
commit
16bae4410d
1 file changed
+6
-5
@@ -5,7 +5,8 @@ name: Gateway
|
||||
# Watchtower's nightly pull there is the fallback when the deploy trigger fails.
|
||||
#
|
||||
# Uses the user-level secrets REGISTRY_USER and REGISTRY_PASSWORD, and the repo secret
|
||||
# DEPLOY_SSH_KEY_HOME, a key that server-gib only accepts for ~/Server/ci-deploy.sh.
|
||||
# DEPLOY_SSH_KEY_HOME_B64, a base64 encoded key that server-gib only accepts for
|
||||
# ~/Server/ci-deploy.sh.
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -78,13 +79,13 @@ jobs:
|
||||
docker push "$IMAGE:latest"
|
||||
|
||||
- name: Deploy
|
||||
# The key comes in through env, not ${{ secrets.* }} in the script: the runner prints the
|
||||
# script, and Gitea does not mask a multi-line secret split across lines.
|
||||
# The secret is the private key base64 encoded on one line. The runner prints each step's
|
||||
# env, and Gitea only masks a secret it can match in full, which a multi-line key defeats.
|
||||
env:
|
||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY_HOME }}
|
||||
DEPLOY_SSH_KEY_B64: ${{ secrets.DEPLOY_SSH_KEY_HOME_B64 }}
|
||||
run: |
|
||||
install -m600 /dev/null "$HOME/.deploy_key"
|
||||
printf '%s\n' "$DEPLOY_SSH_KEY" > "$HOME/.deploy_key"
|
||||
printf '%s' "$DEPLOY_SSH_KEY_B64" | base64 -d > "$HOME/.deploy_key"
|
||||
ssh -i "$HOME/.deploy_key" \
|
||||
-o BatchMode=yes \
|
||||
-o StrictHostKeyChecking=accept-new \
|
||||
|
||||
Reference in new issue
Block a user