From 31c8351b6b4921db55d959bc6086202f1abb3047 Mon Sep 17 00:00:00 2001 From: haemka Date: Thu, 13 Aug 2026 14:46:19 +0000 Subject: [PATCH] Add Gitea Actions workflow to build and deploy the site Requires a self-hosted runner and repo secrets (DEPLOY_HOST, DEPLOY_USER, DEPLOY_PATH, DEPLOY_SSH_KEY) to be set up before it will actually run. --- .gitea/workflows/build-deploy.yml | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .gitea/workflows/build-deploy.yml diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml new file mode 100644 index 0000000..baafa86 --- /dev/null +++ b/.gitea/workflows/build-deploy.yml @@ -0,0 +1,44 @@ +name: Build and deploy + +on: + push: + branches: [master] + workflow_dispatch: {} + +jobs: + build-and-deploy: + # Needs a self-hosted Gitea Actions runner with this label registered + # against git.haemka.in — none exists yet, set one up before enabling this. + 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 + + - name: Checkout (incl. theme submodule) + uses: actions/checkout@v4 + with: + submodules: 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: ${{ secrets.DEPLOY_HOST }} + DEPLOY_USER: ${{ secrets.DEPLOY_USER }} + DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} + DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + run: | + mkdir -p ~/.ssh + printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null + rsync -avz --delete \ + -e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=yes" \ + output/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"