-
Notifications
You must be signed in to change notification settings - Fork 7
51 lines (40 loc) · 1.63 KB
/
ci-remove.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Delete Deployment
on:
delete:
branches: [dev, main, feature/*]
jobs:
delete:
runs-on: ubuntu-latest
steps:
- name: Set DEPLOY_ID which will delete a custom deploy from 'dev' environment
run: |
echo "BRANCH = ${{ github.event.ref }}"
export BRANCH="${{ github.event.ref }}"
echo "::set-output name=DEPLOY_ID::${BRANCH//\//-}"
id: set-deploy-id
- name: Get deploy ID
run: echo "The DEPLOY_ID is ${{ steps.set-deploy-id.outputs.DEPLOY_ID }}"
- uses: actions/checkout@v2
- name: Install oc
uses: redhat-actions/oc-installer@v1
with:
version: '4.6'
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
# Disables SSL cert checking. Use this if you don't have the certificate authority data.
insecure_skip_tls_verify: true
namespace: ${{ env.OPENSHIFT_NAMESPACE }}
- name: 'Get Helm'
run: |
curl -L -O https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz
tar -xf helm-v3.4.2-linux-amd64.tar.gz
- name: 'Delete ALL'
run: |
export PATH=$PATH:`pwd`/linux-amd64
helm delete proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-db
helm delete proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}
helm delete proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-routes
helm delete proto-asp-${{ steps.set-deploy-id.outputs.DEPLOY_ID }}-feeder