-
Notifications
You must be signed in to change notification settings - Fork 4
50 lines (41 loc) · 2.04 KB
/
dispatch-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Dispatch Update Version
on:
repository_dispatch:
types: [update-version]
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v4
- name: Extract tag name
run: echo "TAG_NAME=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
- name: Update Helm chart versions
run: |
TAG_NAME="$(echo "${TAG_NAME}" | sed 's/^v//')"
increment_version() {
echo "$1" | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}'
}
# Update charon Chart.yaml
CHART_VERSION=$(grep '^version:' charts/charon/Chart.yaml | awk '{print $2}')
NEW_CHART_VERSION=$(increment_version $CHART_VERSION)
sed -i "s/^version: .*/version: ${NEW_CHART_VERSION}/" charts/charon/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${TAG_NAME}\"/" charts/charon/Chart.yaml
# Update charon-cluster Chart.yaml
CHART_CLUSTER_VERSION=$(grep '^version:' charts/charon-cluster/Chart.yaml | awk '{print $2}')
NEW_CHART_CLUSTER_VERSION=$(increment_version $CHART_CLUSTER_VERSION)
sed -i "s/^version: .*/version: ${NEW_CHART_CLUSTER_VERSION}/" charts/charon-cluster/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${TAG_NAME}\"/" charts/charon-cluster/Chart.yaml
# Update charon and charon-cluster values.yaml
sed -i -E "/tag:/s/v\.?[0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9\-]*/v${TAG_NAME}/" charts/charon-cluster/values.yaml charts/charon/values.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
branch: update-version-${{ env.TAG_NAME }}
title: "Update version to ${{ env.TAG_NAME }}"
body: "Automatically generated PR to update version to ${{ env.TAG_NAME }}"
commit-message: "Update version to ${{ env.TAG_NAME }}"
author-name: "obol-platform"
author-email: "[email protected]"