Files
haemka.de/.gitea/workflows/build-deploy.yml
T
haemka 3109013403 Track theme submodule via SSH URL, drop CI-only override
origin is already an SSH remote for this repo, so there's no real
reason for the submodule to stay on HTTPS. Removes the runtime
'git config submodule...url' override from the workflow, which is
now redundant.
2026-08-14 16:54:35 +00:00

60 lines
2.0 KiB
YAML

name: Build and deploy
on:
push:
branches: [master]
workflow_dispatch: {}
jobs:
build-and-deploy:
runs-on: self-hosted
container: python:3.12-slim
steps:
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends git rsync openssh-client nodejs
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Set up SSH key and pinned host keys
# Same key used both as the theme repo's deploy key (Gitea) and for
# the webserver login (below) — one secret, two authorized_keys entries.
# Host keys are pinned via a var (known_hosts-format lines, pasted
# directly from a known_hosts file that already trusts both hosts)
# rather than fetched via ssh-keyscan — no extra network calls, no
# TOFU, and no risk of tripping aquaria's connection-rate limiting.
env:
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
KNOWN_HOSTS: ${{ vars.KNOWN_HOSTS }}
run: |
mkdir -p ~/.ssh
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
printf '%s\n' "$KNOWN_HOSTS" >> ~/.ssh/known_hosts
- name: Fetch theme submodule
run: |
GIT_SSH_COMMAND="ssh -4 -i ~/.ssh/deploy_key -o StrictHostKeyChecking=yes" \
git submodule update --init --recursive
- name: Install Python dependencies
run: pip install --no-cache-dir -r requirements.txt
- name: Build site
run: pelican -s publishconf.py
- name: Deploy via rsync
env:
DEPLOY_HOST: ${{ vars.DEPLOY_HOST }}
DEPLOY_PORT: ${{ vars.DEPLOY_PORT }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PATH: ${{ vars.DEPLOY_PATH }}
run: |
rsync -avz --delete \
-e "ssh -4 -i ~/.ssh/deploy_key -p ${DEPLOY_PORT:-22} -o StrictHostKeyChecking=yes" \
output/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"