-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (73 loc) · 2.26 KB
/
update-helm-chart.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
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
name: Workflow for building and publishing Helm charts on GitHub pages
on:
workflow_call:
inputs:
ref:
description: "The main branch name to checkout the repository."
required: false
default: ${{ github.event.repository.default_branch }}
type: string
helm-version:
description: "The helm version."
required: false
default: "v3.8.0"
type: string
target-branch:
description: "The branch to push the Helm chart to (default: gh-pages)"
required: false
default: gh-pages
type: string
secrets:
github-token:
description: "The GitHub token for committing the changes."
required: true
outputs: { }
jobs:
helm-release:
runs-on: ubuntu-20.04
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref}}
token: ${{ secrets.github-token }}
path: main
- name: Setup just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.github-token }}
with:
just-version: 1.5.0
- name: Setup Helm
uses: azure/setup-helm@v1
with:
version: ${{ inputs.helm-version }}
- name: Set commit sha
id: set-commit
run: |
cd ./main
echo "commitSha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Package Helm chart
run: |
mkdir charts
cd main
just package-chart ../charts/
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: ${{ inputs.target-branch }}
token: ${{ secrets.github-token }}
path: gh-pages
- name: Update Helm index
run: |
helm repo index ./charts/ --merge ./gh-pages/index.yaml
mv ./charts/* ./gh-pages/
- name: Commit and push new Helm chart
run: |
cd ./gh-pages
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# Add changes
git add .
git commit -m "Update Helm chart for ${{ steps.set-commit.outputs.commitSha }}"
git push