name: pipeline
on:
  push:
    branches:
      - "master"

permissions:
  packages: write

jobs:
  build-and-push-images:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: https://gitea.com/actions/checkout@v4
      
      - name: Log in to container registry
        uses: docker/login-action@v3
        with:
          registry: https://git.vhaudiquet.fr
          username: ${{ github.actor }}
          password: ${{ secrets.PACKAGES_TOKEN }}
      
      - name: Build and push docker image
        uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          tags: |
            git.vhaudiquet.fr/vhaudiquet/vhaudiquet.fr:latest
            git.vhaudiquet.fr/vhaudiquet/vhaudiquet.fr:${{ github.sha }}
