31 lines
919 B
YAML
31 lines
919 B
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-seed extras nix module).
|
|
name: deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: node
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build the site
|
|
run: |
|
|
npm --prefix site ci
|
|
npm --prefix site run build
|
|
|
|
- name: Publish (atomic dir swap)
|
|
run: |
|
|
set -euo pipefail
|
|
rm -rf /srv/site/current.new
|
|
cp -r site/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
|