7255a71dca
The default per-job Actions token only covers the triggering repo; the theme submodule lives in a separate private repo (hmk/pelican-latex), so cloning it needs a token with read access to both. Add CHECKOUT_TOKEN as a repo secret (a Gitea access token with repo read scope) for this to work.
47 lines
1.5 KiB
YAML
47 lines
1.5 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 (incl. theme submodule)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
# Default job token only covers this repo; the theme submodule
|
|
# (hmk/pelican-latex) is a separate private repo, so a token with
|
|
# read access to both is needed here.
|
|
token: ${{ secrets.CHECKOUT_TOKEN }}
|
|
|
|
- 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}"
|