-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (51 loc) · 1.6 KB
/
helm-index.yml
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
name: Update Helm Charts Index
on:
push:
branches:
- "charts"
paths:
- '**.tgz'
env:
env_var: ${{ vars.ENV_CONTEXT_VAR }}
CHARTS_REPO: "getjavelin/charts"
CHARTS_BRANCH: "charts"
CHARTS_LOCAL_REPO: "charts-repo"
CHART_RETENTION: "20"
jobs:
index-update:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
repository: ${{ env.CHARTS_REPO }}
token: ${{ secrets.DEVOPS_GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: true
ref: ${{ env.CHARTS_BRANCH }}
path: ${{ env.CHARTS_LOCAL_REPO }}
- name: Helm Installation
uses: azure/[email protected]
with:
# version: v3.13.0
version: latest
- name: Update Index
env:
GITHUB_TOKEN: ${{ secrets.DEVOPS_GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "DevOps Bot"
cd ${{ env.CHARTS_LOCAL_REPO }}
git pull
for mychart_ver in $(ls release) ; do
mychart=$(echo ${mychart_ver} | sed "s|_do_not_edit.txt||g")
ls -trl ${mychart}*.tgz | grep -v latest | awk '{print $9}' | tail -n +${{ env.CHART_RETENTION }} | xargs -I {} rm -- {}
done
helm repo index .
git add .
git commit -m "Updating chart index - skip ci"
git push origin ${{ env.CHARTS_BRANCH }}