name: Hosting - Build and push custom Postgresql docker image

on:
  push:
    branches: [main]
    paths:
      - 'hosting/postgresql/**'
      - '.github/workflows/postgres-docker-build-and-push.yml'

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v4
      - name: Login to GHCR
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build & push
        uses: docker/build-push-action@v5
        with:
          context: ./hosting/postgresql
          push: true
          tags: ghcr.io/${{ github.repository_owner }}/postgresql:17
