-
-
Notifications
You must be signed in to change notification settings - Fork 124
ci(helm-docs): deploy helm chart and update the documentation #2807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
oben01
wants to merge
4
commits into
dev
from
2571-feat-automating-documentation-versioning-on-release-using-github-action
+121
−0
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
52fed62
ci(helm-docs): deploy helm chart and update the documentation
5c55e6a
fix: some small issues after testing with act
Meierschlumpf 4b2b532
fix: security warning and restrict token permissions to none
Meierschlumpf cb7895a
Merge branch 'dev' into 2571-feat-automating-documentation-versioning…
Meierschlumpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.