Skip to content

Clean up feature/LGA-3086-ci-cd-setup #2

Clean up feature/LGA-3086-ci-cd-setup

Clean up feature/LGA-3086-ci-cd-setup #2

Workflow file for this run

# Uninstalls the dev helm chart when a PR is merged, or closed
name: Clean up the dev release
run-name: Clean up ${{ github.head_ref }}
on:
pull_request:
types:
- closed
jobs:
clean-up-release:
name: Clean up release
environment: dev
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Authenticate to the cluster
env:
KUBE_NAMESPACE: ${{ secrets.KUBE_NAMESPACE }}
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }}
run: |
echo "${{ secrets.KUBE_CERT }}" > ca.crt
kubectl config set-cluster ${KUBE_CLUSTER} --certificate-authority=./ca.crt --server=https://${KUBE_CLUSTER}
kubectl config set-credentials deploy-user --token=${{ secrets.KUBE_TOKEN }}
kubectl config set-context ${KUBE_CLUSTER} --cluster=${KUBE_CLUSTER} --user=deploy-user --namespace=${KUBE_NAMESPACE}
kubectl config use-context ${KUBE_CLUSTER}
- name: Uninstall the helm chart
run: |
export CLEANED_BRANCH_NAME=$(echo ${{ github.head_ref }} | sed 's/^feature[-/]//' | sed 's:^\w*\/::' | tr -s ' _/[]().' '-' | tr '[:upper:]' '[:lower:]' | cut -c1-28 | sed 's/-$//')
helm uninstall ${CLEANED_BRANCH_NAME}