Skip to content
Open
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
39 changes: 39 additions & 0 deletions .github/workflows/release-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
env:
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_PUSH_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_PUSH_TOKEN_KO }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
Expand Down Expand Up @@ -44,3 +47,39 @@ jobs:
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_SKIP_EXISTING: true

# Publish kong-operator chart to DockerHub (OCI) when its version changes
- name: Determine if kong-operator chart version changed
id: kong_operator_oci
shell: bash
run: |
set -euo pipefail
NEW_VERSION=$(grep -E '^version:' "charts/kong-operator/Chart.yaml" | awk '{print $2}')
SHA="${{ github.event.before }}"
if git show "$SHA:charts/kong-operator/Chart.yaml" >/dev/null 2>&1; then
OLD_VERSION=$(git show "$SHA:charts/kong-operator/Chart.yaml" | grep -E '^version:' | awk '{print $2}')
else
OLD_VERSION=""
fi
echo "new=${NEW_VERSION} old=${OLD_VERSION}"
if [ -n "${NEW_VERSION}" ] && [ "${NEW_VERSION}" != "${OLD_VERSION}" ]; then
echo "publish_oci=true" >> "$GITHUB_OUTPUT"
echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
else
echo "publish_oci=false" >> "$GITHUB_OUTPUT"
fi

- name: Login to DockerHub (OCI)
if: ${{ steps.kong_operator_oci.outputs.publish_oci == 'true' && env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
env:
DOCKERHUB_USERNAME: ${{ env.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ env.DOCKERHUB_TOKEN }}
run: |
helm registry login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_TOKEN" registry-1.docker.io

- name: Push kong-operator chart to DockerHub (OCI)
if: ${{ steps.kong_operator_oci.outputs.publish_oci == 'true' && env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}
run: |
# Save and push the chart explicitly to kong/kong-operator on DockerHub
Copy link
Member Author

@tao12345666333 tao12345666333 Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid conflicts between the Helm chart and KO image tags, we will push to the kong/kong-operator-chart repo. However, there is a limitation here: when pushing to OCI, the path must match the name of the Chart. We may need to modify the name of the Chart.

helm package charts/kong-operator
helm push kong-operator-${{ steps.kong_operator_oci.outputs.version }}.tgz oci://registry-1.docker.io/kong