name: Delete Preview from Staging on: workflow_dispatch: inputs: preview_name: description: Preview Name (domain) required: true jobs: delete-preview: name: Delete Preview Branch if: github.event.inputs.preview_name != 'main' runs-on: ubuntu-latest container: image: getlago/deploy-staging env: PORTER_HOST: https://dashboard.getporter.dev PORTER_CLUSTER: ${{ secrets.PORTER_CLUSTER }} PORTER_PROJECT: ${{ secrets.PORTER_PROJECT }} PORTER_TOKEN: ${{ secrets.PORTER_TOKEN_2643 }} steps: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v1 - name: Configure kubectl run: echo "${{ secrets.KUBE_STAGING_CONFIG }}" | base64 -d > kubeconfig.yaml - name: Get Helm deployment id: helm_deployment run: echo "::set-output name=deployment::$(helm --kubeconfig ./kubeconfig.yaml list -f ${{ github.event.inputs.preview_name }}-app -o=json | jq '.[0].name')" - name: Delete Front Preview if: ${{ steps.helm_deployment.outputs.deployment != 'null' }} run: | helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-app helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-api helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-worker helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-clock helm --kubeconfig ./kubeconfig.yaml uninstall ${{ github.event.inputs.preview_name }}-redis