-
Notifications
You must be signed in to change notification settings - Fork 11
65 lines (57 loc) · 1.61 KB
/
update-helm-repo.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
name: Update Helm Repository
on:
workflow_dispatch:
inputs:
repo:
type: choice
required: true
description: "Which repo to build?"
default: "stable"
options:
- "stable"
- "canary"
workflow_call:
inputs:
repo:
type: string
required: true
description: "Build stable or canary repo?"
default: "stable"
jobs:
call-make-index:
uses: ./.github/workflows/make-charts-index.yaml
with:
repoName: ${{ inputs.repo }}
update-page:
runs-on: ubuntu-latest
needs: call-make-index
permissions:
contents: write # for updating index.yaml
steps:
- uses: actions/checkout@v3
with:
ref: "gh-pages"
- name: Configure Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
- uses: actions/download-artifact@v3
with:
name: "chart-index.${{ inputs.repo }}"
path: ".nindex"
- name: Update index when there's changes
shell: bash
run: |
if [[ "${{ inputs.repo }}" == "stable" ]]; then
path="."
else
path="${{ inputs.repo }}"
# create dir if it doesn't exist yet
[ ! -d "$path" ] && mkdir "$path"
fi
if ! diff -q .nindex/index.yaml "$path/index.yaml"; then
cp .nindex/index.yaml "$path/index.yaml"
git add "$path/index.yaml"
git commit -m "chore(helm-repo): update index.yaml"
git push
fi