name: Gatsby Publish

on:
  push:
    branches: main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Use Node.js from .nvmrc
        uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc
          cache: npm

      - name: Install dependencies
        run: npm ci --legacy-peer-deps

      - name: Check prettier offences
        run: npm run lint

      - uses: enriikke/gatsby-gh-pages-action@v2
        with:
          access-token: ${{ secrets.DCSITE }}
          deploy-branch: gh-pages
          gatsby-args: --prefix-paths
