env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

name: Build windmill:python310
on: workflow_dispatch

concurrency:
  group: ${{ github.ref }}-python3.10
  cancel-in-progress: true

permissions:
  contents: read
  id-token: write
  packages: write

jobs:
  build_ee:
    runs-on: ubicloud
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      # - name: Set up Docker Buildx
      #   uses: docker/setup-buildx-action@v2

      - uses: depot/setup-action@v1

      - name: Login to registry
        uses: docker/login-action@v2
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Edit python version
        run: |
          sed -i 's/python:3.11.4/python:3.10.12/g' Dockerfile

      - name: Build and push publicly ee
        uses: depot/build-push-action@v1
        with:
          context: .
          push: true
          build-args: |
            features=enterprise
          tags: |
            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:python310
          labels: |
            org.opencontainers.image.licenses=Windmill-Enterprise-License
