1- name : Sync Helm Chart
1+ name : Prepare Operator Release
22
33on :
44 workflow_dispatch :
55 inputs :
66 chart_version :
7- description : " Chart version"
7+ description : " Chart version, e.g. x.y.z"
8+ type : string
89 required : true
9- default : " 0.0.0"
10+ operator_version :
11+ description : " Operator version, e.g. x.y.z"
12+ type : string
13+ required : true
14+ k8s_version :
15+ description : " Kubernetes version, e.g. vx.y.z"
16+ type : string
17+ required : true
18+ dry_run :
19+ description : " Do not commit to a PR"
20+ type : boolean
21+ default : false
1022
1123permissions :
1224 contents : read
@@ -18,11 +30,18 @@ jobs:
1830 contents : write
1931 pull-requests : write
2032 steps :
21- - name : Checkout
33+ - name : Checkout Operator
2234 uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2335 with :
2436 token : ${{ secrets.NGINX_PAT }}
2537
38+ - name : Checkout Kubernetes json schemas
39+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
40+ with :
41+ repository : nginxinc/kubernetes-json-schema
42+ path : schemas
43+ token : ${{ secrets.NGINX_PAT }}
44+
2645 - name : Setup Helm
2746 uses : azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
2847 with :
@@ -31,42 +50,70 @@ jobs:
3150 - name : Sync
3251 id : sync
3352 run : |
34- current_version=$(yq e '.appVersion' helm-charts/nginx-ingress/Chart.yaml)
35- echo "Current NIC version: $current_version"
53+ current_nic_version=$(yq e '.appVersion' helm-charts/nginx-ingress/Chart.yaml)
54+ echo "Current NIC version: $current_nic_version"
55+
56+ current_operator_version=$(egrep '^VERSION' Makefile | awk '{ print $3 }')
57+ echo "Current Operator version: $current_operator_version"
3658
3759 cd helm-charts/
38- schema_dir=$(cd nginx-ingress && echo v1.*)
39- mv nginx-ingress/$schema_dir $schema_dir
4060 rm -rf nginx-ingress
4161
4262 helm pull oci://ghcr.io/nginxinc/charts/nginx-ingress --untar --version ${{ inputs.chart_version }}
4363 rm -f nginx-ingress/templates/clusterrole.yaml
4464 rm -f nginx-ingress/templates/controller-role.yaml
4565 rm -f nginx-ingress/templates/controller-rolebinding.yaml
4666 sed -i '14s/name: {{ include "nginx-ingress.fullname" . }}/name: nginx-ingress-operator-nginx-ingress-admin/' nginx-ingress/templates/clusterrolebinding.yaml
47- mv $schema_dir nginx-ingress/
67+
68+ mv ../schemas/${{ inputs.k8s_version }} nginx-ingress/${{ inputs.k8s_version }}
69+ sed -i -e "s#ref\":.*_def#ref\": \"file://./helm-charts/nginx-ingress/${{ inputs.k8s_version }}/_def#" nginx-ingress/values.schema.json
70+ rm -rf ../schemas
4871
49- new_version =$(yq e '.appVersion' nginx-ingress/Chart.yaml)
50- echo "New NIC version: $new_version "
72+ new_nic_version =$(yq e '.appVersion' nginx-ingress/Chart.yaml)
73+ echo "New NIC version: $new_nic_version "
5174
52- echo current_version=$current_version >> $GITHUB_OUTPUT
53- echo new_version=$new_version >> $GITHUB_OUTPUT
75+ echo current_nic_version=$current_nic_version >> $GITHUB_OUTPUT
76+ echo current_operator_version=$current_operator_version >> $GITHUB_OUTPUT
77+ echo new_nic_version=$new_nic_version >> $GITHUB_OUTPUT
78+ echo new_operator_version=${{ inputs.operator_version }} >> $GITHUB_OUTPUT
5479
55- - name : Find and Replace
56- uses : jacobtomlinson/gha-find-replace@099c88fbf2a7da26b083521a8bfa13e4f0886b97 # v3.0.3
80+ - name : Find and Replace NIC version
81+ uses : jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
5782 with :
58- find : ${{ steps.sync.outputs.current_version }}
59- replace : ${{ steps.sync.outputs.new_version }}
83+ find : ${{ steps.sync.outputs.current_nic_version }}
84+ replace : ${{ steps.sync.outputs.new_nic_version }}
6085 regex : false
86+ exclude : .github/**
87+
88+ - name : Find and Replace Operator version
89+ uses : jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
90+ with :
91+ find : ${{ steps.sync.outputs.current_operator_version }}
92+ replace : ${{ steps.sync.outputs.new_operator_version }}
93+ regex : false
94+ exclude : .github/**
95+
96+ - name : Update bundle files
97+ run : |
98+ make bundle
99+ if : ${{ inputs.dry_run }}
100+
101+ - name : Run Diff
102+ run : |
103+ git diff
104+ if : ${{ inputs.dry_run }}
61105
62106 - name : Create Pull Request
63107 uses : peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
64108 with :
65109 token : ${{ secrets.NGINX_PAT }}
66- commit-message : Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}
67- title : Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}
68- branch : feat/update-nic-to-${{ steps.sync.outputs.new_version }}
110+ commit-message : Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_nic_version }}
111+ title : Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_nic_version }}
112+ branch : feat/update-nic-to-${{ steps.sync.outputs.new_nic_version }}
69113 author :
nginx-bot <[email protected] > 70114 body : |
71- This automated PR updates the NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}.
115+ This automated PR updates the NGINX Ingress Controller to ${{ steps.sync.outputs.new_nic_version }}.
72116 The Helm Chart was updated to ${{ inputs.chart_version }}.
117+ The Operator was updated to ${{ inputs.operator_version }}.
118+ Kubernetes was updated to ${{ inputs.k8s_version }}.
119+ if : ${{ ! inputs.dry_run }}
0 commit comments