Skip to content

Commit e6d6140

Browse files
authored
Add workflow to sync the Helm Chart (#138)
1 parent 0c50348 commit e6d6140

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/sync-chart.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Sync Helm Chart
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
chart_version:
7+
description: "Chart version"
8+
required: true
9+
default: "0.0.0"
10+
11+
jobs:
12+
sync:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
17+
18+
- name: Sync
19+
id: sync
20+
run: |
21+
current_version=$(yq e '.appVersion' helm-charts/nginx-ingress/Chart.yaml)
22+
echo "Current NIC version: $current_version"
23+
24+
cd helm-charts/
25+
rm -rf nginx-ingress
26+
helm pull oci://ghcr.io/nginxinc/charts/nginx-ingress --untar --version ${{ inputs.chart_version }}
27+
csplit -s nginx-ingress/templates/rbac.yaml %---%+1 && cat nginx-ingress/templates/rbac.yaml | head -n1 | cat /dev/stdin xx00 > temp_rbac.yaml && mv temp_rbac.yaml nginx-ingress/templates/rbac.yaml
28+
rm -rf xx00
29+
sed -i '14s/name: {{ include "nginx-ingress.fullname" . }}/name: nginx-ingress-operator-nginx-ingress-admin/' nginx-ingress/templates/rbac.yaml
30+
31+
new_version=$(yq e '.appVersion' nginx-ingress/Chart.yaml)
32+
echo "New NIC version: $new_version"
33+
34+
echo current_version=$current_version >> $GITHUB_OUTPUT
35+
echo new_version=$new_version >> $GITHUB_OUTPUT
36+
37+
- name: Find and Replace
38+
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
39+
with:
40+
find: ${{ steps.sync.outputs.current_version }}
41+
replace: ${{ steps.sync.outputs.new_version }}
42+
43+
- name: Create Pull Request
44+
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
45+
with:
46+
commit-message: Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}
47+
title: Update NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}
48+
branch: feat/update-nic-to-${{ steps.sync.outputs.new_version }}
49+
body: |
50+
This automated PR updates the NGINX Ingress Controller to ${{ steps.sync.outputs.new_version }}.
51+
The Helm Chart was updated to ${{ inputs.chart_version }}.

0 commit comments

Comments
 (0)