-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (64 loc) · 2.28 KB
/
uninstall.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Close Pull Request
# only trigger on pull request closed events
on:
pull_request:
branches:
- 'master'
- 'main'
types: [ closed ]
workflow_call:
outputs:
repo_name:
description: "API URL"
value: ${{ jobs.get-repo-name.outputs.repo_name }}
env:
IMAGE_BACK_NAME: starter-back
IMAGE_FRONT_NAME: starter-front
jobs:
get-repo-name:
runs-on: ubuntu-latest
outputs:
repo_name: ${{ steps.get_name.outputs.repo_name }}
steps:
- name: get_name
id: get_name
run: |
echo "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_OUTPUT
- name: print_name
run: |
echo "TOTO ${{ steps.get_name.outputs.repo_name }}"
close_job:
needs: get-repo-name
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF#refs/heads/})"
id: extract_branch
- name: Create kube config
run: |
mkdir -p $HOME/.kube/
echo "${{ secrets.IONOS_KUBE_CONFIG }}" | base64 -d > $HOME/.kube/config
chmod 600 $HOME/.kube/config
- name: Install helm
run: |
curl -LO https://get.helm.sh/helm-v3.8.0-linux-amd64.tar.gz
tar -zxvf helm-v3.8.0-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm
helm version
- name: Install or Update Chart
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ needs.get-repo-name.outputs.repo_name }}-back
VERSION=${{ steps.extract_branch.outputs.branch }}
VERSION=$(echo $VERSION | cut -c -20 | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
helm uninstall ${{ needs.get-repo-name.outputs.repo_name }}-back-$VERSION
- name: Install or Update Chart
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ needs.get-repo-name.outputs.repo_name }}-front
VERSION=${{ steps.extract_branch.outputs.branch }}
VERSION=$(echo $VERSION | cut -c -20 | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
helm uninstall ${{ needs.get-repo-name.outputs.repo_name }}-front-$VERSION