jobs:
  - name: build-site
    public: true
    build_log_retention:
      days: 365
      builds: 50
    plan:
    - get: siterepo
      trigger: true
    - task: build
      config:
        platform: linux
        image_resource:
          type: registry-image
          source:
            repository: registry:8080/dockerhubcache/library/node
            username: build
            password: ((local_registry_key))
            insecure: true
        inputs:
          - name: siterepo
        caches:
          - path: hugo
          - path: node_modules
          - path: dist
        outputs:
          - name: sitegen
        run:
          path: siterepo/.ci/build
    - task: deploy
      config:
        platform: linux
        image_resource:
          type: registry-image
          source:
            repository: registry:8080/blasthavers/deploy-base
            username: build
            password: ((local_registry_key))
            insecure: true
        inputs:
          - name: sitegen
          - name: siterepo
        params:
          DEPLOY_KEY: ((deploy_key))
        run:
          path: siterepo/.ci/deploy
resources:
  - name: siterepo
    type: git
    check_every: never
    webhook_token: ((webhook_token))
    source:
      uri: https://git.blastmud.org/blasthavers/blastmud-site.git
      branch: main
