Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .github/workflows/deployment-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: "[Deployment] Release the helm chart"

permissions: {}

on:
release:
types: [released]

jobs:
release-helm-chart:
runs-on: ubuntu-latest

steps:
- name: Checkout helm chart Repo
uses: actions/checkout@v4
with:
repository: homarr-labs/charts
path: chart-repo
token: ${{ secrets.GITHUB_TOKEN }}
ref: dev

- name: Update artifacthub changelog
run: |
set -eux
export DESCRIPTION="Update ghcr.io/homarr-labs/homarr docker tag to ${{ github.event.release.tag_name }}"
./chart-repo/hack/update-changelog.sh "changed" "$DESCRIPTION"

- name: Extract appVersion from Chart.yaml
id: get-app-version
run: |
set -eux
APP_VERSION=$(yq e '.appVersion' chart-repo/charts/homarr/Chart.yaml | sed 's/^v//')
RELEASE_VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "App version: $APP_VERSION"
echo "Release version: $RELEASE_VERSION"

- name: Determine version type (Major, Minor, Patch)
id: version-check
run: |
set -eux

IFS='.' read -r MAJOR_OLD MINOR_OLD PATCH_OLD <<< "$APP_VERSION"
IFS='.' read -r MAJOR_NEW MINOR_NEW PATCH_NEW <<< "$RELEASE_VERSION"

if [ "$MAJOR_OLD" -lt "$MAJOR_NEW" ]; then
VERSION_TYPE="major"
elif [ "$MINOR_OLD" -lt "$MINOR_NEW" ]; then
VERSION_TYPE="minor"
elif [ "$PATCH_OLD" -lt "$PATCH_NEW" ]; then
VERSION_TYPE="patch"
else
VERSION_TYPE="unknown"
fi

echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
echo "Detected version type: $VERSION_TYPE"

- name: Update chart version
run: |
set -eux
./chart-repo/hack/update-version.sh "$VERSION_TYPE"

- name: Install helm-docs
uses: gabe565/setup-helm-docs-action@v1

- name: Generate Helm docs
working-directory: ./chart-repo
run: |
set -eu
./hack/gen-helm-docs.sh

- name: Commit chart version
run: |
cd chart-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
export COMMIT_MESSAGE="chore(deps): update ghcr.io/homarr-labs/homarr docker tag to ${{ github.event.release.tag_name }}"
git commit -m "$COMMIT_MESSAGE" || echo "No changes to commit"

- name: Obtain token
id: obtainToken
uses: tibdex/github-app-token@v2
with:
private_key: ${{ secrets.HOMARR_DOCS_RELEASE_APP_PRIVATE_KEY }}
app_id: ${{ vars.HOMARR_DOCS_RELEASE_APP_ID }}
installation_retrieval_mode: repository
installation_retrieval_payload: homarr-labs/charts

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
id: cpr
with:
token: ${{ steps.obtainToken.outputs.token }}
branch: release/${{ github.event.release.tag_name }}
base: dev
title: "chore(deps): update ghcr.io/homarr-labs/homarr docker tag to ${{ github.event.release.tag_name }}"
delete-branch: true
path: chart-repo
body: |
### 🔄 Release Helm Chart

This PR updates the Helm chart

- Docker tag updated to: `${{ github.event.release.tag_name }}`
- Branch: `release/${{ github.event.release.tag_name }}`
- Chart version updated based on detected version type: `${{ env.VERSION_TYPE }}`

---
_Automatically generated by GitHub Actions on release event._
labels: |
helm
release

- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" --repo https://github.com/homarr-labs/charts
env:
GH_TOKEN: ${{ steps.obtainToken.outputs.token }}
Loading