diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..dad6c6b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,69 @@ +name: Deploy Hugo site to Pages + +on: + push: + branches: + - trunk + pull_request: + branches: + - trunk + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment, skipping runs queued between the in-progress +# run and the latest queued run, but never cancelling an in-progress deploy. +concurrency: + group: pages-${{ github.ref }} + cancel-in-progress: false + +env: + HUGO_VERSION: 0.164.0 + +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: Install Hugo CLI + run: | + wget -O "${{ runner.temp }}/hugo.deb" \ + "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" + sudo dpkg -i "${{ runner.temp }}/hugo.deb" + + - name: Checkout + uses: actions/checkout@v7 + with: + submodules: recursive + fetch-depth: 0 + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v6 + + - name: Build + env: + HUGO_ENVIRONMENT: production + TZ: Europe/London + run: hugo --gc --minify + + - name: Upload artifact + uses: actions/upload-pages-artifact@v5 + with: + # Matches publishDir in hugo.toml + path: ./docs + + # Pull requests build only — deploying happens once the change lands on trunk. + deploy: + if: github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-24.04 + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v5