Mirror public/ to the server with rsync --delete
Build and deploy the poweronoff.click hugo / build (push) Successful in 45s

The scp deploy used rm:false, so deleted pages and images stayed on the server
forever (e.g. /howto-work-with-stan/ still answered 200 after its removal).

Replace appleboy/scp-action with an rsync --delete --delay-updates step:
- the webroot becomes an exact mirror of public/, deletions propagate
- --delay-updates applies new files last, so a failed run never leaves a
  half-synced site (unlike a pre-clean rm -rf)
- .well-known/ is excluded so ACME challenges survive
- fails loudly if the transfer breaks, instead of silently leaving stale files

Still password auth via sshpass (secrets unchanged); switching to an SSH key is
the remaining follow-up. AGENTS.md updated accordingly.
This commit is contained in:
morpheus committed 2026-11-06 10:13:49 +01:00
1 parent 04e218d1ad
commit b59b3bca78
2 files changed
+50 -15

No files matched your search

+41 -10
View File
@@ -30,18 +30,49 @@ jobs:
with: with:
args: --minify args: --minify
# rsync keeps the webroot an exact mirror of public/, so deleted or
# renamed pages disappear from the server too (scp with rm:false used to
# leave them behind forever). It is incremental: a failed transfer never
# wipes the live site. Password auth is kept for now; switching to an SSH
# key is a follow-up.
- name: Install deploy tools
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
SUDO=""
if command -v sudo >/dev/null 2>&1; then SUDO=sudo; fi
$SUDO apt-get update -qq
$SUDO apt-get install -y -qq rsync sshpass
- name: Deploy - name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/master' if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: appleboy/scp-action@v0.1.7 env:
with: SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
host: poweronoff.click SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
username: ${{ secrets.SSH_USERNAME }} SSH_PORT: ${{ secrets.SSH_PORT }}
password: ${{ secrets.SSH_PASSWORD }} DEPLOY_HOST: poweronoff.click
port: ${{ secrets.SSH_PORT }} DEPLOY_PATH: /var/www/poweronoff.click
source: "public/*" run: |
target: /var/www/poweronoff.click set -euo pipefail
rm: false port="${SSH_PORT:-22}"
strip_components: 1
mkdir -p ~/.ssh
ssh-keyscan -p "$port" -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null
# -rlptz preserves the Hugo output permissions/timestamps
# --delete: remove files that no longer exist in public/
# --delay-updates: swap in the new files last, so visitors never see a
# half-synced site
# .well-known is excluded so ACME/other challenges survive a deploy
export SSHPASS="$SSH_PASSWORD"
sshpass -e rsync -rlptz \
--delete --delay-updates \
--exclude='.well-known/' \
-e "ssh -p $port -o StrictHostKeyChecking=yes" \
public/ "$SSH_USERNAME@$DEPLOY_HOST:$DEPLOY_PATH/"
- name: Verify deployment
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: curl -fsS --retry 5 --retry-delay 3 --retry-connrefused https://poweronoff.click/ -o /dev/null
- name: Send Telegram notification - name: Send Telegram notification
if: always() && github.event_name == 'push' if: always() && github.event_name == 'push'
+9 -5
View File
@@ -70,9 +70,13 @@ Datenschutz/Impressum links now come from `params.footer.text` in `config.yml`.
- Do not touch `config.yml` secrets/analytics IDs, and never commit credentials. - Do not touch `config.yml` secrets/analytics IDs, and never commit credentials.
CI secrets (`SSH_USERNAME`, `SSH_PASSWORD`, `SSH_PORT`, `TELEGRAM_TO`, CI secrets (`SSH_USERNAME`, `SSH_PASSWORD`, `SSH_PORT`, `TELEGRAM_TO`,
`TELEGRAM_TOKEN`) live in Gitea repository settings only. `TELEGRAM_TOKEN`) live in Gitea repository settings only.
- Deploy uses password `scp` and `rm: false`, so removed files are **not** - Deploy mirrors `public/` to the server with
deleted on the server. If you delete a post or image, say so explicitly in `rsync -rltz --delete --delay-updates`, so deleting a post or image also
the PR/commit message so it can be cleaned up by hand. removes it from the live site on the next `master` push. Never place
hand-made files under `/var/www/poweronoff.click` — they will be deleted;
`.well-known/` is excluded for ACME challenges.
- Deploy still authenticates with a password via `sshpass`. Moving to an SSH
key is a known follow-up.
- Theme deprecation warnings are upstream PaperMod noise - Theme deprecation warnings are upstream PaperMod noise
(`.Language.LanguageDirection`, `.Language.LanguageCode`). Do not try to fix (`.Language.LanguageDirection`, `.Language.LanguageCode`). Do not try to fix
them in the submodule; wait for `make theme-update`. There are no other them in the submodule; wait for `make theme-update`. There are no other
@@ -87,5 +91,5 @@ Datenschutz/Impressum links now come from `params.footer.text` in `config.yml`.
- Two posts (`a-letter-to-my-younger-self`, `appreciation`) are drafts whose - Two posts (`a-letter-to-my-younger-self`, `appreciation`) are drafts whose
bodies are still placeholders. They are not published, but do not "clean bodies are still placeholders. They are not published, but do not "clean
them up" without asking — they are the author's unfinished work. them up" without asking — they are the author's unfinished work.
- Deploy would be safer with `rsync --delete` and SSH keys instead of a - Deploy still uses password auth; switch to an SSH key and keep the rsync
password; out of scope unless asked. `--delete` semantics.