Skip to content

Merge pull request #11 from IFRCGo/feature/typo-fix #31

Merge pull request #11 from IFRCGo/feature/typo-fix

Merge pull request #11 from IFRCGo/feature/typo-fix #31

Workflow file for this run

name: Helm
on:
workflow_dispatch:
push:
branches:
- main
permissions:
packages: write
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
with:
push_docker_image: true
build:
name: Publish Helm
needs: ci
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag version in Helm Chart and values.yaml
env:
IMAGE_NAME: ${{ needs.ci.outputs.docker_image_name }}
IMAGE_TAG: ${{ needs.ci.outputs.docker_image_tag }}
run: |
# Update values.yaml with latest docker image
sed -i "s|SET-BY-CICD-IMAGE|$IMAGE_NAME|" ./helm/values.yaml
sed -i "s/SET-BY-CICD-TAG/$IMAGE_TAG/" ./helm/values.yaml
# Helm version
sed -i "s/SET-BY-CICD/$IMAGE_TAG/g" ./helm/Chart.yaml
- name: Package Helm Chart
run: helm package ./helm/ -d ./helm/.helm-charts
- name: Push Helm Chart
env:
IMAGE: ${{ needs.ci.outputs.docker_image }}
OCI_REPO: oci://ghcr.io/${{ github.repository }}
run: |
OCI_REPO=$(echo $OCI_REPO | tr '[:upper:]' '[:lower:]')
PACKAGE_FILE=$(ls ./helm/.helm-charts/*.tgz | head -n 1)
echo "# Helm Chart" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```yaml' >> $GITHUB_STEP_SUMMARY
helm push "$PACKAGE_FILE" $OCI_REPO 2>> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "> [!Important]" >> $GITHUB_STEP_SUMMARY
echo "> Helm Repo URL: **$OCI_REPO**" >> $GITHUB_STEP_SUMMARY
echo "> Helm Chart: **$(helm show chart "$PACKAGE_FILE" | grep '^name:' | awk '{print $2}')**" >> $GITHUB_STEP_SUMMARY
echo "> Helm Target Revision: **$(helm show chart "$PACKAGE_FILE" | grep '^version:' | awk '{print $2}')**" >> $GITHUB_STEP_SUMMARY
echo "> Docker image: **$IMAGE**" >> $GITHUB_STEP_SUMMARY