-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push edge Helm Chart to OCI registries
- Loading branch information
Showing
7 changed files
with
119 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,6 @@ defaults: | |
run: | ||
shell: bash | ||
|
||
env: | ||
HELM_CHART_DIR: deployments/helm-chart | ||
GIT_NAME: NGINX Kubernetes Team | ||
GIT_MAIL: [email protected] | ||
|
||
concurrency: | ||
group: ${{ github.ref_name }}-ci | ||
cancel-in-progress: true | ||
|
@@ -342,62 +337,29 @@ jobs: | |
path: ${{ github.workspace }}/tests/${{ steps.smoke-tests.outputs.test-results-name }}.html | ||
if: always() | ||
|
||
package-helm: | ||
name: Package Helm Chart | ||
runs-on: ubuntu-22.04 | ||
needs: unit-tests | ||
outputs: | ||
version: ${{ steps.var.outputs.helm_version }} | ||
type: ${{ steps.var.outputs.helm_type }} | ||
if: ${{ github.event_name == 'push' }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
- name: Output Variables | ||
id: var | ||
run: | | ||
if ${{ startsWith(github.ref, 'refs/tags/') }}; then | ||
helm_version="$(helm show chart ${{ env.HELM_CHART_DIR }} | grep 'version:' | cut -d ' ' -f 2)" | ||
helm_type="stable" | ||
else | ||
helm_version="0.0.0-edge" | ||
helm_type="edge" | ||
fi | ||
echo "helm_version=$helm_version" >> $GITHUB_OUTPUT | ||
echo "helm_type=$helm_type" >> $GITHUB_OUTPUT | ||
- name: Lint | ||
run: helm lint ${{ env.HELM_CHART_DIR }} | ||
- name: Package | ||
run: helm package --version ${{ steps.var.outputs.helm_version }} ${{ env.HELM_CHART_DIR }} | ||
- name: Upload Chart | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: helm-chart | ||
path: ${{ github.workspace }}/nginx-ingress-${{ steps.var.outputs.helm_version }}.tgz | ||
|
||
release-helm: | ||
name: Release Helm Chart | ||
publish-helm: | ||
name: Package and Publish Helm Chart | ||
runs-on: ubuntu-22.04 | ||
needs: package-helm | ||
needs: helm-tests | ||
if: ${{ github.event_name == 'push' }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | ||
with: | ||
repository: nginxinc/helm-charts | ||
fetch-depth: 1 | ||
token: ${{ secrets.NGINX_PAT }} | ||
- name: Remove previous Chart | ||
run: rm -f ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}/nginx-ingress-${{ needs.package-helm.outputs.version }}.tgz | ||
- name: Retrieve latest Helm Chart | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: helm-chart | ||
path: ${{ github.workspace }}/${{ needs.package-helm.outputs.type }} | ||
- name: Push Helm Chart | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Package | ||
id: package | ||
run: | | ||
output=$(helm package ${{ ! startsWith(github.ref, 'refs/tags/') && '--app-version edge --version 0.0.0-edge' || '' }} deployments/helm-chart) | ||
echo "path=$(basename -- $(echo $output | cut -d: -f2))" >> $GITHUB_OUTPUT | ||
- name: Push to ghcr.io | ||
run: | | ||
helm repo index ${{ needs.package-helm.outputs.type }} --url https://helm.nginx.com/${{ needs.package-helm.outputs.type }} | ||
git add -A | ||
git -c user.name='${{ env.GIT_NAME }}' -c user.email='${{ env.GIT_MAIL }}' \ | ||
commit -m "NGINX Ingress Controller - Release ${{ needs.package-helm.outputs.type }} ${{ needs.package-helm.outputs.version }}" | ||
git push -u origin master | ||
helm push ${{ steps.package.outputs.path }} oci://ghcr.io/nginxinc/charts | ||
helm push ${{ steps.package.outputs.path }} oci://registry-1.docker.io/nginxcharts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.