Skip to content

Commit

Permalink
Release will make a PR that updates chart.yaml and this trigger the h…
Browse files Browse the repository at this point in the history
…elm chart release

Signed-off-by: Jirka Kremser <[email protected]>
  • Loading branch information
jkremser committed Oct 16, 2024
1 parent dd0ecfd commit c9061a8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 25 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,9 @@ permissions:
contents: read

jobs:
check-if-new-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: yq
uses: mikefarah/[email protected]
- name: Compare versions
run: |
latest_version=$(make version)
maybe_old_version=$(yq '.version' helmchart/otel-add-on/Chart.yaml)
echo "latest_version: ${latest_version}"
echo "maybe_old_version: ${maybe_old_version}"
if [ "${latest_version}" != "${maybe_old_version}" ]; then
echo "modifying Chart.yaml.."
yq -i ".version=${latest_version} | .appVersion=${latest_version}" helmchart/otel-add-on/Chart.yaml
git add helmchart/otel-add-on/Chart.yaml
git commit -s -m "Updating Chart.yaml: ${maybe_old_version} -> ${latest_version}"
git push
fi
test:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, '[post-release]')
needs: [check-if-new-version]
steps:
- uses: actions/checkout@v4
Expand All @@ -60,6 +38,7 @@ jobs:
publish:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, '[post-release]')
needs: [test]
steps:
- uses: actions/checkout@v4
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,49 @@ jobs:
uses: kedify/github-meta/.github/workflows/kedify-release.yml@main
with:
tag: ${{ github.ref_name }}

post-release-work:
runs-on: ubuntu-latest
needs: [ build-and-publish-images ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: yq
uses: mikefarah/[email protected]
- name: Compare versions
id: version
run: |
latest_version=$(make version)
maybe_old_version=$(yq '.version' helmchart/otel-add-on/Chart.yaml)
echo "latest_version: ${latest_version}"
echo "maybe_old_version: ${maybe_old_version}"
if [ "${latest_version}" != "${maybe_old_version}" ]; then
echo "modifying Chart.yaml.."
yq -i ".version=\"${latest_version}\" | .appVersion=\"${latest_version}\"" helmchart/otel-add-on/Chart.yaml
echo "newVersion=${latest_version}" >> ${GITHUB_OUTPUT}
echo "oldVersion=${maybe_old_version}" >> ${GITHUB_OUTPUT}
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@b4d51739f96fca8047ad065eccef63442d8e99f7 # tag=v4
id: cpr
with:
title: "Update webpage"
branch: chart-yaml-update
path: public
token: ${{ secrets.PAT_TOKEN }}
commit-message: "[post-release] Updating Chart.yaml: ${{ steps.version.outputs.oldVersion }} -> ${{ steps.version.outputs.oldVersion }}"
delete-branch: true
base: master
signoff: true
body: |
:package: Chart.yaml update :package:
### automated change
Updating Chart.yaml: ${{ steps.version.outputs.oldVersion }} -> ${{ steps.version.outputs.oldVersion }}
This automated PR was created by [this action](https://github.com/kedify/otel-add-on/actions/runs/${{ github.run_id }}).
- name: Check PR
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | tee -a "$GITHUB_STEP_SUMMARY"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | tee -a "$GITHUB_STEP_SUMMARY"
4 changes: 2 additions & 2 deletions helmchart/otel-add-on/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: otel-add-on
description: A Helm chart for otel-add-on
type: application
version: v0.0.0-1
appVersion: v0.0.0-1
version: v0.0.0-0
appVersion: v0.0.0-0
kubeVersion: ">= 1.19.0-0"
icon: https://raw.githubusercontent.com/kedacore/keda/main/images/keda-logo-500x500-white.png

Expand Down

0 comments on commit c9061a8

Please sign in to comment.