1+ name : " [Deployment] Release the helm chart"
2+
3+ on :
4+ release :
5+ types : [released]
6+
7+ jobs :
8+ release-helm-chart :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout helm chart Repo
13+ uses : actions/checkout@v4
14+ with :
15+ repository : homarr-labs/charts
16+ path : chart-repo
17+ token : ${{ secrets.GITHUB_TOKEN }}
18+ ref : dev
19+
20+ - name : Update artifacthub changelog
21+ run : |
22+ set -eux
23+ export DESCRIPTION="Update ghcr.io/homarr-labs/homarr docker tag to ${{ github.event.release.tag_name }}"
24+ ./chart-repo/hack/update-changelog.sh "changed" "$DESCRIPTION"
25+
26+ - name : Extract appVersion from Chart.yaml
27+ id : get-app-version
28+ run : |
29+ set -eux
30+ APP_VERSION=$(yq e '.appVersion' chart-repo/charts/homarr/Chart.yaml | sed 's/^v//')
31+ RELEASE_VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
32+ echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
33+ echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
34+ echo "App version: $APP_VERSION"
35+ echo "Release version: $RELEASE_VERSION"
36+
37+ - name : Determine version type (Major, Minor, Patch)
38+ id : version-check
39+ run : |
40+ set -eux
41+
42+ IFS='.' read -r MAJOR_OLD MINOR_OLD PATCH_OLD <<< "$APP_VERSION"
43+ IFS='.' read -r MAJOR_NEW MINOR_NEW PATCH_NEW <<< "$RELEASE_VERSION"
44+
45+ if [ "$MAJOR_OLD" -lt "$MAJOR_NEW" ]; then
46+ VERSION_TYPE="major"
47+ elif [ "$MINOR_OLD" -lt "$MINOR_NEW" ]; then
48+ VERSION_TYPE="minor"
49+ elif [ "$PATCH_OLD" -lt "$PATCH_NEW" ]; then
50+ VERSION_TYPE="patch"
51+ else
52+ VERSION_TYPE="unknown"
53+ fi
54+
55+ echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
56+ echo "Detected version type: $VERSION_TYPE"
57+
58+ - name : Update chart version
59+ run : |
60+ set -eux
61+ ./chart-repo/hack/update-version.sh "$VERSION_TYPE"
62+
63+ - name : Install helm-docs
64+ uses : gabe565/setup-helm-docs-action@v1
65+
66+ - name : Generate Helm docs
67+ run : |
68+ set -eu
69+ ./chart-repo/hack/gen-helm-docs.sh
70+
71+ - name : Commit chart version
72+ run : |
73+ cd chart-repo
74+ git config user.name "github-actions[bot]"
75+ git config user.email "github-actions[bot]@users.noreply.github.com"
76+ git add .
77+ export COMMIT_MESSAGE="chore(deps): update ghcr.io/homarr-labs/homarr docker tag to ${{ github.event.release.tag_name }}"
78+ git commit -m "$COMMIT_MESSAGE" || echo "No changes to commit"
79+
80+ - name : Obtain token
81+ id : obtainToken
82+ uses : tibdex/github-app-token@v2
83+ with :
84+ private_key : ${{ secrets.HOMARR_DOCS_SYNC_APP_PRIVATE_KEY }}
85+ app_id : ${{ vars.HOMARR_DOCS_RELEASE_APP_ID }}
86+ installation_retrieval_mode : repository
87+ installation_retrieval_payload : homarr-labs/documentation
88+
89+ - name : Create Pull Request
90+ uses : peter-evans/create-pull-request@v7
91+ id : cpr
92+ with :
93+ token : ${{ steps.obtainToken.outputs.token }}
94+ branch : docs/update-helm-docs
95+ base : master
96+ title : Update Helm chart documentation
97+ delete-branch : true
98+ path : target-repo
99+ body : |
100+ This PR updates the documentation file to match the latest Helm chart changes.
101+ labels : |
102+ helm
103+ docs
104+
105+ - name : Enable Pull Request Automerge
106+ if : steps.cpr.outputs.pull-request-operation == 'created'
107+ run : gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" --repo https://github.com/homarr-labs/documentation
108+ env :
109+ GH_TOKEN : ${{ steps.obtainToken.outputs.token }}
0 commit comments