-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (43 loc) · 1.44 KB
/
check-helm-chart-version.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
name: Check Helm Chart Version
on:
push:
paths:
- 'charts/**/Chart.yaml'
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
charts: ${{ steps.check-version.outputs.charts }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Check Chart Version
id: check-version
run: |
echo "{\"include\":[]}" > chart.json
git diff --name-only HEAD^ HEAD | grep Chart.yaml | while read line; do
CHART=$(grep '^name: ' $line | cut -d ' ' -f 2)
VERSION=$(grep '^version: ' $line | cut -d ' ' -f 2)
jq --arg CHART "$CHART" --arg VERSION "$VERSION" '.include += [{"chart":$CHART,"version":$VERSION}]' chart.json > temp.json && mv temp.json chart.json
done
echo "charts=$(jq -c . < ./chart.json)" >> $GITHUB_OUTPUT
cat chart.json
repository-dispatch:
needs: check-version
strategy:
matrix: ${{fromJson(needs.check-version.outputs.charts)}}
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GHP_TOKEN }}
repository: team-xquare/xquare-infrastructure-global
event-type: chart-update
client-payload: |
{
"chart": "${{ matrix.chart }}",
"version": "${{ matrix.version }}"
}