Skip to content

feat: add case study and contact models and queries #1

feat: add case study and contact models and queries

feat: add case study and contact models and queries #1

Workflow file for this run

name: Helm
on:
workflow_dispatch:
workflow_call:
outputs:
helm_repo_url:
description: "Helm repo URL"
value: ${{ jobs.build.outputs.helm_repo_url }}
helm_chart:
description: "Helm Chart"
value: ${{ jobs.build.outputs.helm_chart }}
helm_target_revision:
description: "Helm target revision"
value: ${{ jobs.build.outputs.helm_target_revision }}
docker_image:
description: "Docker image"
value: ${{ jobs.ci.outputs.docker_image }}
push:
branches:
- develop
- project/*
permissions:
packages: write
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
with:
push_docker_image: true
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build:
name: Publish Helm
needs: ci
runs-on: ubuntu-latest
outputs:
helm_repo_url: ${{ steps.push.outputs.helm_repo_url }}
helm_chart: ${{ steps.push.outputs.helm_chart }}
helm_target_revision: ${{ steps.push.outputs.helm_target_revision }}
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: 🐳 Helm dependency
run: |
yq --indent 0 '.dependencies | map(select(.repository | test("^oci:") | not)) | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' ./helm/Chart.lock | sh --
helm dependency build ./helm/
- name: Tag docker image in Helm Chart 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
- name: Package Helm Chart
id: set-variables
env:
IMAGE_TAG: ${{ needs.ci.outputs.docker_image_tag }}
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG="-$(echo $GITHUB_SHA | head -c7)"
sed -i "s/-SET-BY-CICD/$TAG/g" ./helm/Chart.yaml
else
# XXX: Check if there is a slash in the BRANCH_NAME eg: project/add-docker
if [[ "$GITHUB_REF_NAME" == *"/"* ]]; then
# XXX: Change the helm chart to <chart-dev-name>
sed -i 's/^\(name:.*\)-helm$/\1-dev-helm/' ./helm/Chart.yaml
fi
sed -i "s/SET-BY-CICD/$IMAGE_TAG/g" ./helm/Chart.yaml
fi
helm package ./helm/ -d ./helm/.helm-charts
- name: Push Helm Chart
id: push
env:
IMAGE: ${{ needs.ci.outputs.docker_image }}
OCI_REPO: oci://ghcr.io/${{ github.repository_owner }}
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
# Add annotations as well
HELM_CHART=$(helm show chart "$PACKAGE_FILE" | grep '^name:' | awk '{print $2}')
HELM_TARGET_REVISION=$(helm show chart "$PACKAGE_FILE" | grep '^version:' | awk '{print $2}')
echo "::notice::Helm Repo URL: **$OCI_REPO**"
echo "::notice::Helm Chart: **$HELM_CHART**"
echo "::notice::Helm Target Revision: **$HELM_TARGET_REVISION**"
# Add outputs as well
echo "helm_repo_url=$OCI_REPO" >> $GITHUB_OUTPUT
echo "helm_chart=$HELM_CHART" >> $GITHUB_OUTPUT
echo "helm_target_revision=$HELM_TARGET_REVISION" >> $GITHUB_OUTPUT