diff --git a/.github/workflows/helm_release_pr.yml b/.github/workflows/helm_release_pr.yml new file mode 100644 index 00000000..00f74cdd --- /dev/null +++ b/.github/workflows/helm_release_pr.yml @@ -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 }}" + }