-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (88 loc) · 3.13 KB
/
publish.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#
# Copyright 2024 tosit.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: publish
on:
workflow_call:
inputs:
chart_name:
description: Helm chart version
required: true
type: string
version:
description: Helm chart version
required: true
type: string
env:
release_tag_name: ${{ inputs.chart_name }}-v${{ inputs.version }}
chart_package_name: ${{ inputs.chart_name }}-${{ inputs.version }}.tgz
cr_release_name_template: "{{ .Name }}-v{{ .Version }}"
defaults:
run:
shell: bash
jobs:
helm-chart-publish:
name: "Publish (${{ inputs.chart_name }}-${{ inputs.version }})"
runs-on: "ubuntu-latest"
steps:
- name: Checkout release tag ${{ env.release_tag_name }} ⚡️
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.release_tag_name }}
- name: Setup helm
uses: azure/[email protected]
with:
version: v3.15.1
- name: Add chart dependencies
run: |
helm repo add superset https://apache.github.io/superset
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Install chart-releaser (cr)
uses: helm/[email protected]
with:
install_only: true
- name: Package helm chart ${{ inputs.chart_name }} (${{ inputs.version }})
run: |
helm dependency build ${{ inputs.chart_name }}
cr package ${{ inputs.chart_name }}
- name: Upload Chart package to Github release
run: |
gh release upload ${{ env.release_tag_name }} ./.cr-release-packages/${{ env.chart_package_name }} --clobber
env:
GH_TOKEN: ${{ github.token }}
shell: bash
- name: Checkout gh-pages branch ⚡️
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: gh-pages
path: gh-pages
- name: Update helm chart index.yaml
run: |
cr index -i gh-pages/index.yaml \
-r ${GITHUB_REPOSITORY#*/} \
-o ${{ github.repository_owner }} \
--release-name-template "${{ env.cr_release_name_template }}"
shell: bash
- name: Commit helm chart index.yaml changes into gh-pages branch
uses: EndBug/add-and-commit@v9
with:
cwd: gh-pages
pull: "--rebase --autostash"
message: '[${{ inputs.chart_name }}-${{ inputs.version }}] - Update index.yaml'
author_name: github-actions[bot]
author_email: 41898282+github-actions[bot]@users.noreply.github.com