Skip to content

Commit ab24480

Browse files
committed
Push edge Helm Chart to OCI registries
1 parent ce9c5fe commit ab24480

File tree

7 files changed

+119
-126
lines changed

7 files changed

+119
-126
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ defaults:
2121
run:
2222
shell: bash
2323

24-
env:
25-
HELM_CHART_DIR: deployments/helm-chart
26-
GIT_NAME: NGINX Kubernetes Team
27-
28-
2924
concurrency:
3025
group: ${{ github.ref_name }}-ci
3126
cancel-in-progress: true
@@ -342,62 +337,29 @@ jobs:
342337
path: ${{ github.workspace }}/tests/${{ steps.smoke-tests.outputs.test-results-name }}.html
343338
if: always()
344339

345-
package-helm:
346-
name: Package Helm Chart
347-
runs-on: ubuntu-22.04
348-
needs: unit-tests
349-
outputs:
350-
version: ${{ steps.var.outputs.helm_version }}
351-
type: ${{ steps.var.outputs.helm_type }}
352-
if: ${{ github.event_name == 'push' }}
353-
steps:
354-
- name: Checkout Repository
355-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
356-
- name: Output Variables
357-
id: var
358-
run: |
359-
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
360-
helm_version="$(helm show chart ${{ env.HELM_CHART_DIR }} | grep 'version:' | cut -d ' ' -f 2)"
361-
helm_type="stable"
362-
else
363-
helm_version="0.0.0-edge"
364-
helm_type="edge"
365-
fi
366-
echo "helm_version=$helm_version" >> $GITHUB_OUTPUT
367-
echo "helm_type=$helm_type" >> $GITHUB_OUTPUT
368-
- name: Lint
369-
run: helm lint ${{ env.HELM_CHART_DIR }}
370-
- name: Package
371-
run: helm package --version ${{ steps.var.outputs.helm_version }} ${{ env.HELM_CHART_DIR }}
372-
- name: Upload Chart
373-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
374-
with:
375-
name: helm-chart
376-
path: ${{ github.workspace }}/nginx-ingress-${{ steps.var.outputs.helm_version }}.tgz
377-
378-
release-helm:
379-
name: Release Helm Chart
340+
publish-helm:
341+
name: Package and Publish Helm Chart
380342
runs-on: ubuntu-22.04
381-
needs: package-helm
343+
needs: helm-tests
382344
if: ${{ github.event_name == 'push' }}
345+
permissions:
346+
contents: read
347+
packages: write
383348
steps:
384349
- name: Checkout Repository
385350
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
351+
- name: Login to GitHub Container Registry
352+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
386353
with:
387-
repository: nginxinc/helm-charts
388-
fetch-depth: 1
389-
token: ${{ secrets.NGINX_PAT }}
390-
- name: Remove previous Chart
391-
run: rm -f ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}/nginx-ingress-${{ needs.package-helm.outputs.version }}.tgz
392-
- name: Retrieve latest Helm Chart
393-
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
394-
with:
395-
name: helm-chart
396-
path: ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}
397-
- name: Push Helm Chart
354+
registry: ghcr.io
355+
username: ${{ github.repository_owner }}
356+
password: ${{ secrets.GITHUB_TOKEN }}
357+
- name: Package
358+
id: package
359+
run: |
360+
output=$(helm package ${{ ! startsWith(github.ref, 'refs/tags/') && '--app-version edge --version 0.0.0-edge' || '' }} deployments/helm-chart)
361+
echo "path=$(basename -- $(echo $output | cut -d: -f2))" >> $GITHUB_OUTPUT
362+
- name: Push to ghcr.io
398363
run: |
399-
helm repo index ${{ needs.package-helm.outputs.type }} --url https://helm.nginx.com/${{ needs.package-helm.outputs.type }}
400-
git add -A
401-
git -c user.name='${{ env.GIT_NAME }}' -c user.email='${{ env.GIT_MAIL }}' \
402-
commit -m "NGINX Ingress Controller - Release ${{ needs.package-helm.outputs.type }} ${{ needs.package-helm.outputs.version }}"
403-
git push -u origin master
364+
helm push ${{ steps.package.outputs.path }} oci://ghcr.io/nginxinc/charts
365+
helm push ${{ steps.package.outputs.path }} oci://registry-1.docker.io/nginxcharts

.github/workflows/lint.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ jobs:
4848
- uses: reviewdog/action-actionlint@b6feb003955cad286985c42e7047f4567a798f3f # v1.36.0
4949
with:
5050
actionlint_flags: -shellcheck ""
51+
52+
chart-lint:
53+
name: Chart Lint
54+
runs-on: ubuntu-22.04
55+
steps:
56+
- name: Checkout Repository
57+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
58+
- name: Lint chart
59+
run: helm lint deployments/helm-chart

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ We publish Ingress Controller releases on GitHub. See our [releases page](https:
5555

5656
The latest stable release is [3.0.2](https://github.com/nginxinc/kubernetes-ingress/releases/tag/v3.0.2). For production use, we recommend that you choose the latest stable release.
5757

58-
The edge version is useful for experimenting with new features that are not yet published in a stable release. To use, choose the *edge* version built from the [latest commit](https://github.com/nginxinc/kubernetes-ingress/commits/main) from the main branch.
58+
The edge version is useful for experimenting with new features that are not yet published in a stable release. To use it, choose the *edge* version built from the [latest commit](https://github.com/nginxinc/kubernetes-ingress/commits/main) from the main branch.
5959

6060
To use the Ingress Controller, you need to have access to:
6161
* An Ingress Controller image.

0 commit comments

Comments
 (0)