From aa3a967d21d4187a51d8d6359a138d2ac6741594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Cierzniakowski?= Date: Thu, 5 Nov 2026 19:49:09 +0100 Subject: [PATCH] fix: deploy-static-site - remove the SSH key when the action ends --- deploy-static-site/README.md | 2 ++ deploy-static-site/action.yaml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/deploy-static-site/README.md b/deploy-static-site/README.md index 4e9bb92..4e7734d 100644 --- a/deploy-static-site/README.md +++ b/deploy-static-site/README.md @@ -30,6 +30,8 @@ Kolejno: 3. `rsync` do `releases//` na serwerze. 4. `ssh prod activate ` przełącza `current`, a serwer zostawia 3 ostatnie wydania. Potem `ssh prod list` wypisuje je do logu. +5. Usuwa klucz, `config` i `known_hosts` z `~/.ssh` (`if: always()`, także po błędzie). + Kolejne kroki joba nie mają już klucza ani aliasu `prod`. ## Wejście diff --git a/deploy-static-site/action.yaml b/deploy-static-site/action.yaml index d92c2c7..d362207 100644 --- a/deploy-static-site/action.yaml +++ b/deploy-static-site/action.yaml @@ -82,3 +82,9 @@ runs: # shellcheck disable=SC2029 # the id is meant to expand on the CI side ssh prod activate "$RELEASE" ssh prod list + + # Runs even after a failed upload/activate, so a later step of the job cannot reuse the key. + - name: Remove SSH key + if: always() + shell: sh + run: rm -f ~/.ssh/deploy ~/.ssh/config ~/.ssh/known_hosts