-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflow): create pipeline to update chart (#69)
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: "Update Helm Chart Tag" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
new_version: | ||
description: 'New version to update' | ||
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: master | ||
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 "HELM_BRANCH_MERGE=${{ env.HELM_BRANCH_MERGE }}${{ github.event.client_payload.new_version }}" >> $GITHUB_ENV | ||
echo "HELM_VERSION=${{ github.event.client_payload.new_version }}" >> $GITHUB_ENV | ||
else | ||
echo "HELM_BRANCH_MERGE=${{ env.HELM_BRANCH_MERGE }}${{ github.event.client_payload.new_version }} >> $GITHUB_ENV | ||
echo "HELM_VERSION=${{ inputs.new_version }}" >> $GITHUB_ENV | ||
fi | ||
echo "version: ${HELM_VERSION#v}" | ||
echo "appVersion: ${HELM_VERSION}" | ||
echo "HELM_BRANCH_MERGE: ${HELM_BRANCH_MERGE}" | ||
- name: Checkout master branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.HELM_BRANCH }} | ||
|
||
- name: Update Tag in YAML File | ||
id: edit-chart-version | ||
env: | ||
HELM_VERSION: ${{ env.HELM_VERSION }} | ||
run: | | ||
git config user.name "${{ env.CI_COMMIT_AUTHOR }}" | ||
git config user.email "${{ env.CI_COMMIT_EMAIL }}" | ||
# Update the appVersion with the new tag | ||
yq e -i ".appVersion = \"${HELM_VERSION}\"" ${{ env.CHART_FILE }} | ||
# Update the version with the new tag, removing the leading 'v' | ||
yq e -i ".version = \"${HELM_VERSION#v}\"" ${{ env.CHART_FILE }} | ||
git add ${{ env.CHART_FILE }} | ||
git commit -m "Update version to ${HELM_VERSION#v} and appVersion to ${HELM_VERSION}" | ||
- name: Create Pull Request | ||
id: create-pr | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.GITHUB_ACCESS_TOKEN }} | ||
branch: ${{ env.HELM_BRANCH_MERGE }} | ||
delete-branch: true | ||
title: 'Helm chart update to ${HELM_VERSION#v}' | ||
body: | | ||
Helm Chart update to new version: | ||
- In ${{ env.CHART_FILE }} new version is ${HELM_VERSION#v} | ||
- In ${{ env.CHART_FILE }} new appVersion is ${HELM_VERSION} | ||
- Auto-generated by "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Action URL>" | ||
labels: | | ||
automated pr |