-
Notifications
You must be signed in to change notification settings - Fork 2
98 lines (83 loc) · 2.84 KB
/
release.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Deploy Helm Charts
on:
push:
branches:
- main
permissions:
id-token: write
contents: write
packages: write
jobs:
package-and-publish:
name: Package and Publish Helm Charts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
- name: Check for changes in Helm Charts
id: check-changes
uses: tj-actions/changed-files@v42
- name: Detect modified charts
id: changes
shell: bash
run: |
for file in ${{ steps.check-changes.outputs.all_changed_and_modified_files }}; do
baseFolder=$(cut -d'/' -f1 <<< "$file")
if [ $baseFolder = "charts" ]; then
echo "changed=true" >> "$GITHUB_ENV"
break;
fi
done
- name: Build Helm Chart Dependencies
if: env.changed == 'true'
run: |
helm repo add in2workspace https://in2workspace.github.io/helm-charts
helm repo update
CHARTS=$(find charts -mindepth 1 -maxdepth 1 -type d -printf "%f\n")
for CHART in $CHARTS; do
if [ -d "charts/$CHART" ]; then
echo "📦 Building dependencies for $CHART"
helm dependency build "charts/$CHART"
fi
done
- name: Validate Helm Charts
if: env.changed == 'true'
run: |
CHARTS=$(find charts -mindepth 1 -maxdepth 1 -type d -printf "%f\n")
for CHART in $CHARTS; do
if [ -d "charts/$CHART" ]; then
helm lint "charts/$CHART"
helm template "charts/$CHART" > /dev/null
fi
done
- name: Generate Helm Chart Version
id: generate-version
uses: zwaldowski/semver-release-action@v3
with:
bump: patch
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git User
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Publish Helm Charts
if: env.changed == 'true'
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true
with:
pages_branch: gh-pages
- name: Create GitHub Release
if: env.changed == 'true'
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ steps.generate-version.outputs.version }}
prerelease: false
title: ${{ steps.generate-version.outputs.version }}