diff --git a/.github/workflows/helm_pr_deployment.yml b/.github/workflows/helm_pr_deployment.yml index 76c16ca52284..f795a64b7cdc 100644 --- a/.github/workflows/helm_pr_deployment.yml +++ b/.github/workflows/helm_pr_deployment.yml @@ -2,7 +2,7 @@ name: Deploy PR to Kubernetes on: pull_request: - types: [opened, synchronize, reopened, closed] + types: [opened, synchronize, reopened] workflow_run: workflows: ["tests"] branches: [main] @@ -11,7 +11,6 @@ on: jobs: deploy: - if: github.event.action != 'closed' runs-on: ubuntu-latest environment: k8s concurrency: k8s @@ -107,29 +106,3 @@ jobs: ` }); - - destroy: - if: github.event.action == 'closed' - runs-on: ubuntu-latest - steps: - - name: Setup Helm - uses: azure/setup-helm@v3 - with: - version: v3.15.0 - - - name: Setup Kubectl - uses: azure/setup-kubectl@v3 - with: - version: v1.30.1 - - - name: Authenticate to Kubernetes cluster - run: | - echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config - - - name: Delete Helm release - run: | - helm uninstall artemis --namespace artemis-pr${{ github.event.pull_request.number }} - - - name: Delete Kubernetes namespace - run: | - kubectl delete namespace pr${{ github.event.pull_request.number }} diff --git a/.github/workflows/helm_pr_deployment_delete.yml b/.github/workflows/helm_pr_deployment_delete.yml new file mode 100644 index 000000000000..0a405fba5d43 --- /dev/null +++ b/.github/workflows/helm_pr_deployment_delete.yml @@ -0,0 +1,39 @@ +name: Deploy PR to Kubernetes + +on: + pull_request: + types: [opened, synchronize, reopened] + workflow_run: + workflows: ["tests"] + branches: [main] + types: + - completed + +jobs: + destroy: + runs-on: ubuntu-latest + environment: k8s + concurrency: k8s + + steps: + - name: Setup Helm + uses: azure/setup-helm@v3 + with: + version: v3.15.0 + + - name: Setup Kubectl + uses: azure/setup-kubectl@v3 + with: + version: v1.30.1 + + - name: Authenticate to Kubernetes cluster + run: | + echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config + + - name: Delete Helm release + run: | + helm uninstall artemis --namespace artemis-pr${{ github.event.pull_request.number }} + + - name: Delete Kubernetes namespace + run: | + kubectl delete namespace pr${{ github.event.pull_request.number }}