ci: fix Nix GC cleanup job SSH key secret for Booster-role

This commit is contained in:
asepharyana
2026-08-04 14:04:44 +07:00
parent 240fd76fc8
commit 5fe57c63d9
+7 -6
View File
@@ -102,10 +102,11 @@ jobs:
env:
VPS_HOST: ${{ secrets.VPS_HOST }}
VPS_USER: ${{ secrets.VPS_USER }}
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H "$VPS_HOST" >> ~/.ssh/known_hosts 2>/dev/null
ssh "$VPS_USER@$VPS_HOST" "sudo /usr/local/bin/nix-gc-vps.sh" || echo "⚠️ Nix GC gagal (non-fatal)"
key_file=$(mktemp /tmp/gc-key.XXXXXX)
printf '%s\n' "$VPS_SSH_KEY" > "$key_file"
chmod 600 "$key_file"
sed -i 's/\r$//' "$key_file"
ssh -i "$key_file" -o StrictHostKeyChecking=no "${VPS_USER}@${VPS_HOST}" "sudo /usr/local/bin/nix-gc-vps.sh" || echo "⚠️ Nix GC gagal (non-fatal)"
rm -f "$key_file"