-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (74 loc) · 2.54 KB
/
helm-chart-run-ci.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
72
73
74
75
76
77
78
79
80
81
82
83
name: Helm Chart CI
on:
push:
branches:
- master
paths:
- 'kubernetes/helm-charts/**'
- '.github/workflows/custom-containers-run-ci.yaml'
- '!kubernetes/helm-charts/docs/**'
jobs:
find-out-changes:
runs-on: ubuntu-latest
outputs:
changed_directories: ${{ steps.set-output.outputs.changed_directories }}
steps:
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42.0.7
with:
dir_names: true
json: true
quotepath: false
files: |
kubernetes/helm-charts/**
!kubernetes/helm-charts/docs/**
- name: 'Set output in the matrix format'
id: set-output
run: echo "changed_directories={\"dir\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
build-and-publish:
runs-on: ubuntu-latest
if: ${{ needs.find-out-changes.outputs.changed_directories != '' }}
strategy:
matrix: ${{fromJson(needs.find-out-changes.outputs.changed_directories)}}
needs:
- find-out-changes
container:
image: aidanhilt/atils-ci:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Find Chart.yaml directory
run: |
chart_dir=$(pwd)
while [[ $chart_dir != "/" ]]; do
if [[ -f "$chart_dir/Chart.yaml" ]]; then
echo "Found Chart.yaml in directory: $chart_dir"
echo "CHART_DIR=$chart_dir" >> $GITHUB_ENV
break
fi
chart_dir=$(dirname "$chart_dir")
done
if [[ $chart_dir == "/" ]]; then
echo "Chart.yaml not found in any parent directory starting from {{ matrix.dir }}"
exit 1
fi
working-directory: "{{ matrix.dir }}"
- name: Check for .atils_buildconfig.json in directory
id: check-buildconfig
run: |
if [ ! -f "$CHART_DIR/.atils_buildconfig.json" ]; then
echo "No .atils_buildconfig.json found in $CHART_DIR. Exiting with an error"
exit 1
fi
- name: Build and publish Helm
if: steps.check-buildconfig.outcome == 'success'
run: |
atils build --build-directory "$CHART_DIR" --action-set ci-build-publish