Skip to content

Prepare Operator Release #25

Prepare Operator Release

Prepare Operator Release #25

Workflow file for this run

name: Sync Helm Chart
on:
workflow_dispatch:
inputs:
chart_version:
description: "Chart version"
required: true
default: "0.0.0"
permissions:
contents: read
jobs:
sync:
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: ${{ secrets.NGINX_PAT }}
- name: Setup Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Sync
id: sync
run: |
current_version=$(yq e '.appVersion' helm-charts/nginx-ingress/Chart.yaml)
echo "Current NIC version: $current_version"
cd helm-charts/
schema_dir=$(cd nginx-ingress && echo v1.*)
mv nginx-ingress/$schema_dir $schema_dir
rm -rf nginx-ingress
helm pull oci://ghcr.io/nginxinc/charts/nginx-ingress --untar --version ${{ inputs.chart_version }}
rm -f nginx-ingress/templates/clusterrole.yaml
rm -f nginx-ingress/templates/controller-role.yaml
rm -f nginx-ingress/templates/controller-rolebinding.yaml
sed -i '14s/name: {{ include "nginx-ingress.fullname" . }}/name: nginx-ingress-operator-nginx-ingress-admin/' nginx-ingress/templates/clusterrolebinding.yaml
mv $schema_dir nginx-ingress/
new_version=$(yq e '.appVersion' nginx-ingress/Chart.yaml)
echo "New NIC version: $new_version"
echo current_version=$current_version >> $GITHUB_OUTPUT
echo new_version=$new_version >> $GITHUB_OUTPUT
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
with:
find: ${{ steps.sync.outputs.current_version }}
replace: ${{ steps.sync.outputs.new_version }}
regex: false
- name: Create Pull Request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
token: ${{ secrets.NGINX_PAT }}
commit-message: Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}
title: Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}
branch: feat/update-nic-to-${{ steps.sync.outputs.new_version }}
author: nginx-bot <[email protected]>
body: |
This automated PR updates the NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}.
The Helm Chart was updated to ${{ inputs.chart_version }}.