# Build the website with Hugo and publish it to brain.tdehaeze.xyz # # Runs on the homelab act_runner (see homelab.org). # The generated site is written to /docker/brain/public on the host, # which is served by the `brain` Caddy container. # The old site is only replaced once the build succeeded. name: Deploy on: push: branches: [main] workflow_dispatch: concurrency: group: deploy cancel-in-progress: true jobs: deploy: runs-on: ubuntu-latest container: # Keep the same Hugo version as locally (`hugo version`) image: ghcr.io/gohugoio/hugo:v0.166.0 volumes: - /docker/brain:/deploy steps: - name: Build and publish shell: sh run: | set -eu git clone --depth 1 --branch "$GITHUB_REF_NAME" \ --recurse-submodules --shallow-submodules \ "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" /tmp/site cd /tmp/site rm -rf /deploy/.new /deploy/.old hugo --gc --destination /deploy/.new if [ -d /deploy/public ]; then mv /deploy/public /deploy/.old; fi mv /deploy/.new /deploy/public rm -rf /deploy/.old