33 lines
1.0 KiB
YAML
33 lines
1.0 KiB
YAML
# The editable-site pipeline: every push to main builds the astro site
|
|
# and swaps it into the publish directory Caddy serves (astro.<base> +
|
|
# the APEX + www). The runner binds /var/lib/astro-site into the job
|
|
# container at /srv/site (see the app tree's deploy-backend extras
|
|
# module). This file rides the SITE REPO (pushed by the bootstrap's E5)
|
|
# — the paths are this repo's root, not an enclosing app tree.
|
|
name: deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: node
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build the site
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Publish (atomic dir swap)
|
|
run: |
|
|
set -euo pipefail
|
|
rm -rf /srv/site/current.new
|
|
cp -r dist /srv/site/current.new
|
|
rm -rf /srv/site/current.old
|
|
if [ -d /srv/site/current ]; then mv /srv/site/current /srv/site/current.old; fi
|
|
mv /srv/site/current.new /srv/site/current
|
|
rm -rf /srv/site/current.old
|