name: Build and Push Docker Image

on:
  push:
    branches:
      - main

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    container:
      image: catthehacker/ubuntu:act-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Generate datetime tag
        id: vars
        run: echo "tag=$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT

      - name: Log in to Gitea Registry
        uses: docker/login-action@v3
        with:
          registry: git.arnemoerman.be
          username: arne
          password: ${{ secrets.PAT_TOKEN }}

      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          context: ./For Real Consulting
          file: ./For Real Consulting/Dockerfile
          push: true
          tags: |
            git.arnemoerman.be/arne/for-real-consulting:latest
            git.arnemoerman.be/arne/for-real-consulting:${{ steps.vars.outputs.tag }}
