---
on:
  push:
    branches:
      - 'main'
  workflow_dispatch:

jobs:
  all:
    runs-on: 'self-hosted'
    steps:
      - uses: 'actions/checkout@v4'
      - uses: 'actions/setup-go@v5'
        with:
          go-version-file: 'search/go.mod'
      - name: 'fmt'
        run: |
          make tidy no-dirty
      - name: 'build'
        run: |
          make build
      # we need the build step done before the go checks can run because we need
      # the index.html file generated by the hugo build
      - name: 'check'
        run: |
          make check no-dirty
      - name: 'deploy'
        run: |
          make deploy
        env:
          SSH_PRIVATE_KEY: '${{ secrets.SSH_PRIVATE_KEY }}'