name: "Deploy Miniplan"

on:
  push:
    branches:
      - "main"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to Gitea Container Registry
        uses: docker/login-action@v2
        with:
          registry: git.walamana.de
          username: ${{vars.actions_user}}
          password: ${{secrets.PACKAGES_TOKEN}}

      - name: Build Docker image
        run: docker build -t git.walamana.de/walamana/miniplan .

      - name: Push Docker image to registry
        run: docker push git.walamana.de/walamana/miniplan

      - name: Update stack on Portainer
        uses: newarifrh/portainer-service-webhook@v1
        with:
          webhook_url: ${{ secrets.WEBHOOK_URL }}
