Skip to content

Commit 52fed62

Browse files
oussama Dahmazoussama Dahmaz
oussama Dahmaz
authored and
oussama Dahmaz
committed
ci(helm-docs): deploy helm chart and update the documentation
1 parent 98ecc68 commit 52fed62

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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_RELEASE_APP_PRIVATE_KEY }}
85+
app_id: ${{ vars.HOMARR_DOCS_RELEASE_APP_ID }}
86+
installation_retrieval_mode: repository
87+
installation_retrieval_payload: homarr-labs/charts
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: release/${{ github.event.release.tag_name }}
95+
base: dev
96+
title: 'chore(deps): update ghcr.io/homarr-labs/homarr docker tag to ${{ github.event.release.tag_name }}'
97+
delete-branch: true
98+
path: target-repo
99+
body: |
100+
### 🔄 Release Helm Chart
101+
102+
This PR updates the Helm chart
103+
104+
- Docker tag updated to: `${{ github.event.release.tag_name }}`
105+
- Branch: `release/${{ github.event.release.tag_name }}`
106+
- Chart version updated based on detected version type: `${{ env.VERSION_TYPE }}`
107+
108+
---
109+
_Automatically generated by GitHub Actions on release event._
110+
labels: |
111+
helm
112+
release
113+
114+
- name: Enable Pull Request Automerge
115+
if: steps.cpr.outputs.pull-request-operation == 'created'
116+
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" --repo https://github.com/homarr-labs/charts
117+
env:
118+
GH_TOKEN: ${{ steps.obtainToken.outputs.token }}

0 commit comments

Comments
 (0)