Update helm chart from ci (#1167)

# What this PR does

Add github action workflow to automatically bump oncall helm chart version on each release and create a PR with this change

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
This commit is contained in:
Ildar Iskhakov 2023-01-20 16:23:04 +08:00 committed by GitHub
parent 98241b9a10
commit 2bc88663c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

45
.github/workflows/helm_release_pr.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: Create PR to release updated oncall Helm chart
on:
push:
tags:
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# with added v in front of semver2 regex
- "^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
jobs:
update-helm-chart-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Define app_version and helm version
id: tags
run: |
# Strip git ref prefix from version
APP_VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && HELM_VERSION=$(echo $APP_VERSION | sed -e 's/^v//')
echo "::set-output name=app_version::$APP_VERSION"
echo "::set-output name=helm_version::$HELM_VERSION"
- name: Update oncall Helm chart Chart.yaml
uses: fjogeleit/yaml-update-action@v0.12.3
with:
valueFile: 'helm/oncall/Chart.yaml'
branch: helm-release/${{ steps.tags.outputs.helm_version }}
targetBranch: main
masterBranchName: main
createPR: 'true'
description: "Merge this PR to `main` branch to start another
[github actions job](https://github.com/grafana/oncall/blob/dev/.github/workflows/helm_release.yml)
that will release the updated version of the chart
(version: ${{ steps.tags.outputs.helm_version }}, appVersion: ${{ steps.tags.outputs.app_version }})
into `grafana/helm-charts` helm repository. \n\n
This PR was created automatically by this
[github action](https://github.com/grafana/oncall/blob/dev/.github/workflows/helm_release_pr.yml)."
message: 'Release oncall Helm chart ${{ steps.tags.outputs.helm_version }}'
changes: |
{
"version": "${{ steps.tags.outputs.helm_version }}",
"appVersion": "${{ steps.tags.outputs.app_version }}"
}