engine: nixery
when:
  - event: push
    branch: master

dependencies:
  nixpkgs:
    - go
    - gcc
    - nodejs
    - tailwindcss

steps:
  - name: patch static dir
    command: |
      mkdir -p appview/pages/static/logos

  - name: build dolly
    command: |
      go build -o dolly.out ./cmd/dolly

  - name: generate favicons
    command: |
      ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.png -size 180x180
      ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.ico -size 48x48
      ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.svg -color currentColor

  - name: generate css
    command: |
      tailwindcss -i input.css -o appview/pages/static/tw.css

  - name: build blog cmd
    command: |
      go build -o blog.out ./cmd/blog

  - name: build static site
    command: |
      ./blog.out build

  - name: deploy
    command: |
      npx --yes wrangler pages deploy --branch master --project-name tangled-blog ./build
