1
- name : Sync Helm Chart
1
+ name : Prepare Operator Release
2
2
3
3
on :
4
4
workflow_dispatch :
5
5
inputs :
6
6
chart_version :
7
- description : " Chart version"
7
+ description : " Chart version, e.g. x.y.z"
8
+ type : string
8
9
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
10
22
11
23
permissions :
12
24
contents : read
@@ -18,11 +30,18 @@ jobs:
18
30
contents : write
19
31
pull-requests : write
20
32
steps :
21
- - name : Checkout
33
+ - name : Checkout Operator
22
34
uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
23
35
with :
24
36
token : ${{ secrets.NGINX_PAT }}
25
37
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
+
26
45
- name : Setup Helm
27
46
uses : azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
28
47
with :
@@ -31,42 +50,70 @@ jobs:
31
50
- name : Sync
32
51
id : sync
33
52
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"
36
58
37
59
cd helm-charts/
38
- schema_dir=$(cd nginx-ingress && echo v1.*)
39
- mv nginx-ingress/$schema_dir $schema_dir
40
60
rm -rf nginx-ingress
41
61
42
62
helm pull oci://ghcr.io/nginxinc/charts/nginx-ingress --untar --version ${{ inputs.chart_version }}
43
63
rm -f nginx-ingress/templates/clusterrole.yaml
44
64
rm -f nginx-ingress/templates/controller-role.yaml
45
65
rm -f nginx-ingress/templates/controller-rolebinding.yaml
46
66
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
48
71
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 "
51
74
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
54
79
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
57
82
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 }}
60
85
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 }}
61
105
62
106
- name : Create Pull Request
63
107
uses : peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
64
108
with :
65
109
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 }}
69
113
author :
nginx-bot <[email protected] >
70
114
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 }}.
72
116
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