name: Build and Publish Docker Image

on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]
  workflow_dispatch:

jobs:
  build-and-push:
    runs-on: docker

    steps:
      - name: Checkout repository
        uses: https://code.forgejo.org/actions/checkout@v4

      - name: Build and publish admin image
        uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
        with:
          context: ./backend
          image-suffix: -admin
          push: ${{ github.event_name != 'pull_request' }}
          token: ${{ secrets.FORGEJO_PACKAGE_TOKEN }}
