when:
  - event: ["push"]
    branch: ["main"]

engine: "nixery"

clone:
  skip: false
  depth: 1
  submodules: true

dependencies:
  nixpkgs:
    - hugo
    - nodejs

steps:
  - name: "Verify theme"
    command: "ls themes/typo/layouts/partials/svg.html && echo 'Theme OK' || (echo 'Theme missing, cloning...' && git clone --depth 1 https://github.com/tomfran/typo.git themes/typo && rm -rf themes/typo/.git)"

  - name: "Build static site"
    command: "hugo build"

  - name: "Deploy to Cloudflare Pages"
    command: "npx --yes wrangler pages deploy --branch main --project-name blog ./public"
