@@ -3,14 +3,12 @@ name: Release Helm chart
3
3
# yamllint disable-line rule:truthy
4
4
on :
5
5
workflow_dispatch :
6
- pull_request : {} # Temporary while testing
7
6
7
+ env :
8
+ BIN_PATH : bin
9
+ PACKAGE_PATH : package
10
+ INDEX_PATH : index
8
11
9
- # env:
10
- # CR_CONFIGFILE: "${{ github.workspace }}/source/.github/configs/cr.yaml"
11
- # CR_INDEX_PATH: "${{ github.workspace }}/.cr-index"
12
- # CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool"
13
- # CR_VERSION: "1.6.1"
14
12
jobs :
15
13
release :
16
14
runs-on : ubuntu-latest
32
30
- name : Set up Helm
33
31
uses : azure/setup-helm@v4
34
32
33
+ - name : Install CR tool
34
+ run : |
35
+ mkdir "${BIN_PATH}"
36
+ mkdir "${PACKAGE_PATH}"
37
+ mkdir "${INDEX_PATH}"
38
+ crVersion=$(gh release list --repo helm/chart-releaser --exclude-pre-releases --json tagName --jq '.[0].tagName' | sed 's/v//')
39
+ curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v${crVersion}/chart-releaser_${crVersion}_linux_amd64.tar.gz"
40
+ tar -xzf cr.tar.gz -C "${BIN_PATH}"
41
+ rm -f cr.tar.gz
42
+
35
43
- name : Configure Git
36
44
run : |
37
45
cd source
42
50
git config user.name "$GITHUB_ACTOR"
43
51
git config user.email "[email protected] "
44
52
45
- # - name: Install CR tool
46
- # run: |
47
- # mkdir "${CR_TOOL_PATH}"
48
- # mkdir "${CR_PACKAGE_PATH}"
49
- # mkdir "${CR_INDEX_PATH}"
50
- # curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v${CR_VERSION}/chart-releaser_${CR_VERSION}_linux_amd64.tar.gz"
51
- # tar -xzf cr.tar.gz -C "${CR_TOOL_PATH}"
52
- # rm -f cr.tar.gz
53
-
54
53
- name : Parse Chart.yaml
55
54
id : parse-chart
56
55
working-directory : source
78
77
helm repo add kepler https://sustainable-computing-io.github.io/kepler-helm-chart
79
78
helm repo add opencost https://opencost.github.io/opencost-helm-chart
80
79
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
81
- mkdir ../build
82
- helm package charts/k8s-monitoring --destination ../build
80
+ helm package charts/k8s-monitoring --destination "../${PACKAGE_PATH}"
83
81
84
- - name : Make release on K8s Monitoring Helm
82
+ - name : Create release on grafana/k8s-monitoring-helm
85
83
uses : softprops/action-gh-release@v2
86
84
with :
87
85
name : ${{ steps.parse-chart.outputs.tagVersion }}
@@ -90,29 +88,36 @@ jobs:
90
88
prerelease : ${{ steps.parse-version.outputs.prerelease != '' }}
91
89
token : ${{ secrets.GH_BOT_ACCESS_TOKEN }}
92
90
generate_release_notes : true
93
- files : build /${{ steps.parse-chart.outputs.packagename }}.tgz
91
+ files : ${{ env.PACKAGE_PATH }} /${{ steps.parse-chart.outputs.packagename }}.tgz
94
92
fail_on_unmatched_files : true
95
93
96
- # # Note that this creates a release in grafana/helm-charts with a new tag.
94
+ # # Note that this creates a release in grafana/helm-charts GitHub Repository with a new tag.
97
95
# # The tag name in grafana/helm-charts is <package>-<version>, while the
98
96
# # tag name for grafana/k8s-monitoring-helm is <version>.
99
- # - name: Make release on Helm Charts
100
- # uses: softprops/action-gh-release@v2
101
- # with:
102
- # name: ${{ steps.parse-chart.outputs.packagename }}
103
- # repository: grafana/helm-charts
104
- # tag_name: ${{ steps.parse-chart.outputs.packagename }}
105
- # token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
106
- # body: |
107
- # ${{ steps.parse-chart.outputs.desc }}
108
- #
109
- # Source commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
110
- #
111
- # Tag on source: https://github.com/${{ github.repository }}/releases/tag/${{ steps.parse-chart.outputs.tagname }}
112
- # files: |
113
- # ${{ env.CR_PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz
114
- #
115
- # - name: Update helm-charts index.yaml
116
- # run: |
117
- # cd helm-charts
118
- # "${CR_TOOL_PATH}/cr" index --config "${CR_CONFIGFILE}" --token "${{ secrets.GH_BOT_ACCESS_TOKEN }}" --index-path "${CR_INDEX_PATH}" --package-path "${CR_PACKAGE_PATH}" --push
97
+ - name : Create release on grafana/helm-charts
98
+ uses : softprops/action-gh-release@v2
99
+ with :
100
+ name : ${{ steps.parse-chart.outputs.packagename }}
101
+ repository : grafana/helm-charts
102
+ tag_name : ${{ steps.parse-chart.outputs.packagename }}
103
+ prerelease : ${{ steps.parse-version.outputs.prerelease != '' }}
104
+ token : ${{ secrets.GH_BOT_ACCESS_TOKEN }}
105
+ body : |
106
+ ${{ steps.parse-chart.outputs.desc }}
107
+
108
+ Source commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
109
+
110
+ Tag on source: https://github.com/${{ github.repository }}/releases/tag/${{ steps.parse-chart.outputs.tagname }}
111
+ files : ${{ env.PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz
112
+ fail_on_unmatched_files : true
113
+
114
+
115
+ - name : Update helm-charts index.yaml
116
+ working-directory : helm-charts
117
+ env :
118
+ CR_OWNER : grafana
119
+ CR_GIT_REPO : helm-charts
120
+ CR_PACKAGE_PATH : ${{ env.PACKAGE_PATH }}
121
+ CR_SKIP_EXISTING : true
122
+ CR_TOKEN : " ${{ secrets.GH_BOT_ACCESS_TOKEN }}"
123
+ run : " ${BIN_PATH}/cr" index --index-path "${INDEX_PATH}" --push
0 commit comments