fix: Add Helm chart (#21852)

* Initial draft for helm chart

* Add CI using helm releaser

Add helm chart docummentation

Add configuration.yaml values

* Set maintainer

set right defaults on values.yaml

* Add ci to update values on chart

* Add chart version on CI

* Remove manual update of the chart

* Trigger update of Chart.yaml with release_please

* Add chart to release-please

* Add version to release-please manifest for chart

* remove the second release-please

* Update appVersion in chart.yaml too

* Add make target to generate helm-docs

* Generate docs and manage versions in release-please

* Add persistent static volumes

* Small fixes, ensure no volume works

* Fixes for static provisioned volume

* Delete yq dependency in CI

* Delete Makefile, update release-please to run doc generation directly

---------

Co-authored-by: jose <jose.pedrosa@reddit.com>
This commit is contained in:
Jose Luis Pedrosa
2024-05-06 20:30:09 +02:00
committed by GitHub
co-authored by jose
parent 358e2eee45
commit b2e8b3e00c
14 changed files with 666 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
name: Release Charts
on:
push:
branches:
- main
paths:
- 'charts/**'
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+33
View File
@@ -26,6 +26,39 @@ jobs:
target-branch: dev
token: ${{secrets.GH_TOKEN}}
# we use grep,awk,sed here because the output from release-please despite being JSON, it's not valid (probably shell-escaping) and
# jq fails to parse it. Creates the output pr_branch
- name: Get the branch of the release-please PR
id: get_pr_branch
if: ${{ steps.release.outputs.prs_created == 'true' }}
run: |
BRANCH=$(echo '${{ steps.release.outputs.prs }}' | grep -o -P '\"headBranchName\":\"(.*?)\"' | awk -F':' '{print $2}' | tr -d \")
echo "pr_branch=${BRANCH}" >> $GITHUB_OUTPUT
# Checkout PR branch
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.prs_created == 'true' }}
with:
repository: koenkk/zigbee2mqtt
path: ./z2m-pr
ref: ${{ steps.get_pr_branch.outputs.pr_branch }}
- name: Add updated helm chart release versions and documentation to release PR
if: ${{ steps.release.outputs.prs_created == 'true' }}
run: |
pushd ./z2m-pr
Z2M_VERSION="$(jq -r '."."' .release-please-manifest.json)"
yq -i ".appVersion=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/Chart.yaml
yq -i ".image.tag=\"${Z2M_VERSION}\"" charts/zigbee2mqtt/values.yaml
# Keep chart version in step lock with zigbee2mqtt
jq ".\"charts/zigbee2mqtt\"=\"${Z2M_VERSION}\"" .release-please-manifest.json > .release-please-manifest.json
go run github.com/norwoodj/helm-docs/cmd/helm-docs@latest
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "chore(release): update helm-chart docs"
git push
# Checkout repos
- uses: actions/checkout@v4
with: