- website/layouts/_partials/extend_head.html: injects <meta name="x-version"> using HUGO_PARAMS_GITVERSION (set by Taskfile at build time) - Taskfile: website-build sets HUGO_PARAMS_GITVERSION=<short HEAD>; new website-verify task runs scripts/website-verify.sh - scripts/website-verify.sh: fetches homepage, retries 6x/10s, checks that the deployed version hash matches HEAD - website.yml: Verify step after Deploy; scripts/website-verify.sh added to path trigger Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
name: Deploy Website
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'website/**'
|
|
- 'scripts/website-verify.sh'
|
|
- '.forgejo/workflows/website.yml'
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Build & Deploy Website
|
|
runs-on: self-hosted
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Enable Nix flakes
|
|
run: |
|
|
mkdir -p ~/.config/nix
|
|
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
|
|
|
- name: Setup SSH
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.WEBSITE_SSH_PRIVATE_KEY }}
|
|
run: |
|
|
if [ -n "$SSH_PRIVATE_KEY" ]; then
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
else
|
|
echo "Error: WEBSITE_SSH_PRIVATE_KEY secret is not set."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Deploy
|
|
env:
|
|
SSH_USER: ${{ secrets.WEBSITE_SSH_USER }}
|
|
SSH_HOST: ${{ secrets.WEBSITE_SSH_HOST }}
|
|
run: nix develop --command task website-deploy
|
|
|
|
- name: Verify
|
|
run: nix develop --command task website-verify
|