name: build-builder

on:
  push:
    branches: [ builder ]
  schedule:
    - cron: '30 0 * * *'

env:
  GO_VERSION: "1.20.11"

jobs:

  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: builder

      - uses: docker/setup-qemu-action@v3
      - uses: docker/setup-buildx-action@v3

      - uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - uses: docker/build-push-action@v5
        with:
          context: .
          pull: true
          push: true
          tags: lwch/natpass-builder:${{ env.GO_VERSION }}
          build-args: |
            GO_VERSION=${{ env.GO_VERSION }}