on:
  pull_request:
    branches:
      - main
    paths:
      - backend/**

name: Build and deploy the backend to staging

jobs:
  build-and-push:
    name: Build and push image
    uses: ./.gitea/workflows/workflow_build-image.yaml
    with:
      tag: unstable
    secrets:
      PACKAGE_REGISTRY_ACCESS: ${{ secrets.PACKAGE_REGISTRY_ACCESS }}
  
  deploy-prod:
    name: Deploy to staging
    uses: ./.gitea/workflows/workflow_deploy-container.yaml
    with:
      overlay: stg
    secrets:
      KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
    needs: build-and-push