-
Notifications
You must be signed in to change notification settings - Fork 27
93 lines (82 loc) · 3.41 KB
/
bump-version.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: "Update Helm Chart Version"
on:
workflow_dispatch:
inputs:
new_version:
description: 'New version to update (ex: v0.20.4)'
required: true
type: string
repository_dispatch:
types: [update-helm-chart-version]
permissions:
actions: read
contents: write
pull-requests: write
env:
CI_COMMIT_AUTHOR: bump-version-wf
CI_COMMIT_EMAIL: [email protected]
HELM_BRANCH_MERGE: "feat(helm)/update-to-"
CHART_FILE: charts/kestra/Chart.yaml
jobs:
update-helm-chart:
runs-on: ubuntu-latest
steps:
- name: Set HELM_VERSION
id: set-helm-version
run: |
if [ -n "${{ github.event.client_payload.new_version }}" ]; then
echo "Event of type update-helm-chart-version received from ${{ github.event.client_payload.new_version }}"
echo "new_version=${{ github.event.client_payload.new_version }}"
echo "Trigger: ${{ github.event.client_payload.github_actor }}"
HELM_VERSION=${{ github.event.client_payload.new_version }}
echo "HELM_VERSION=${{ github.event.client_payload.new_version }}" >> $GITHUB_ENV
else
HELM_VERSION=${{ inputs.new_version }}
echo "HELM_VERSION=${{ inputs.new_version }}" >> $GITHUB_ENV
fi
echo "version: ${HELM_VERSION#v}"
echo "appVersion: ${HELM_VERSION}"
echo "HELM_CHART_VERSION=${HELM_VERSION#v}" >> $GITHUB_ENV
- name: Checkout master branch
uses: actions/checkout@v4
with:
ref: master
- name: Check latest version
id: check-latest-version
run: |
LATEST_VERSION=$(yq eval '.version' charts/kestra/Chart.yaml)
echo "LATEST_VERSION = ${LATEST_VERSION}"
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
- name: Compare versions
id: compare_versions
uses: jackbilestech/[email protected]
continue-on-error: true
with:
head: ${{ env.HELM_CHART_VERSION }}
base: ${{ env.LATEST_VERSION }}
operator: '>'
- name: Update version and appVersion in Chart.yaml File
id: edit-chart-version
run: |
git config user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config user.email "${{ env.CI_COMMIT_EMAIL }}"
yq e -i ".appVersion = \"${{ env.HELM_VERSION }}\"" ${{ env.CHART_FILE }}
yq e -i ".version = \"${{ env.HELM_CHART_VERSION }}\"" ${{ env.CHART_FILE }}
git add ${{ env.CHART_FILE }}
git commit -m "Update version to ${{ env.HELM_CHART_VERSION }} and appVersion to ${{ env.HELM_VERSION }}"
- name: Create Pull Request
if: ${{ steps.compare_versions.outcome == 'success' }}
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_ACCESS_TOKEN }}
branch: ${{ env.HELM_BRANCH_MERGE }}${{ env.HELM_VERSION }}
delete-branch: true
title: 'Helm chart update from to ${{ env.HELM_CHART_VERSION }}'
body: |
Helm Chart update to new version:
- In `${{ env.CHART_FILE }}` new `version` is ${{ env.HELM_CHART_VERSION }}
- In `${{ env.CHART_FILE }}` new `appVersion` is ${{ env.HELM_VERSION }}
- Auto-generated by [Action URL][1]
[1]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
labels: |
automated pr