Skip to content

fix(helm-charts): Fix Bitnami Helm chart repository and Docker regist… #7

fix(helm-charts): Fix Bitnami Helm chart repository and Docker regist…

fix(helm-charts): Fix Bitnami Helm chart repository and Docker regist… #7

Workflow file for this run

name: Release
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-*
env:
SHA: ${{ github.sha }}
jobs:
pre:
name: .pre
permissions:
contents: write
uses: ./.github/workflows/build.yml
secrets: inherit
push:
name: Push Docker images
runs-on: ubuntu-24.04
needs: [pre]
permissions:
packages: write
contents: read
actions: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare job outputs
id: op
run: |
echo "tag=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
echo "date=$(date +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
echo "app_version=$(sed "s/^v//" <<< ${GITHUB_REF#refs/*/})" >> "$GITHUB_OUTPUT"
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ env.SHA }}
path: /tmp
- name: Load image
run: |
docker load --input /tmp/${{ github.event.repository.name }}-${{ github.sha }}.tar
docker tag ${{ github.repository }}:${{ github.sha }} ${{ github.repository }}:${{ steps.op.outputs.tag }}
docker tag ${{ github.repository }}:${{ github.sha }} ghcr.io/${{ github.repository }}:${{ steps.op.outputs.tag }}
- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to the GH Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker images to DockerHub
run: |
docker push docker.io/${{ github.repository }}:${{ steps.op.outputs.tag }}
docker push docker.io/${{ github.repository }}:latest
- name: Push Docker images to GH Container registry
run: |
docker push ghcr.io/${{ github.repository }}:${{ steps.op.outputs.tag }}
docker push ghcr.io/${{ github.repository }}:latest
outputs:
gitTag: ${{ steps.op.outputs.tag }}
appVersion: ${{ steps.op.outputs.app_version }}
date: ${{ steps.op.outputs.date }}
update-changelog:
name: Update Changelog
runs-on: ubuntu-24.04
needs: [push]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
fromTag: ${{ github.ref_name }}
toTag: ${{ env.previousTag }}
writeToFile: true
useGitmojis: false
includeInvalidCommits: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GH_ACTIONS_BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GH_ACTIONS_BOT_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_options: '-s -S'
commit_user_name: github-actions[bot]
commit_user_email: 46712946+hayk96@users.noreply.github.com
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }}'
file_pattern: CHANGELOG.md
publish-chart:
name: Publish Helm chart
runs-on: ubuntu-24.04
needs: [update-changelog]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Release Chart
env:
GH_TOKEN: ${{ github.token }}
run: |
# Create directories
mkdir -p .cr-release-packages
# Package chart
echo "Packaging chart..."
helm dependency update charts/${{ github.event.repository.name }} || exit 1
helm package ./charts/* -d .cr-release-packages || exit 1
# Get latest tag
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $latest_tag"
# Create GitHub release
echo "Creating release..."
gh release create $latest_tag .cr-release-packages/*.tgz \
--title "$latest_tag" \
--generate-notes
# Checkout gh-pages without removing existing files
git fetch origin gh-pages
git checkout gh-pages
# Update index
echo "Updating index..."
helm repo index .cr-release-packages \
--url https://github.com/${{ github.repository }}/releases/download/$latest_tag \
--merge index.yaml
# Update index.yaml
cp .cr-release-packages/index.yaml ./index.yaml
git add index.yaml
# Configure git
git config --global user.name github-actions[bot]
git config --global user.email 46712946+hayk96@users.noreply.github.com
# Commit and push
git commit \
--author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>" \
-m "Update index.yaml for release $latest_tag"
git push origin gh-pages
echo "Chart release completed successfully"