Skip to content

Commit

Permalink
Governance: Automatically update the appVersion in Chart when released
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshkio committed Aug 16, 2024
1 parent cd63e91 commit 23efba5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,40 @@ jobs:
args: release --clean --config .goreleaser/${{ env.GO_RELEASER_CONFIG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get new chart version from the chart repo
id: get_chart_version
run: |
helm repo add kusionstack https://kusionstack.github.io/charts
helm repo update
version=$(helm search repo kusionstack/karpor --versions | head -n 2 | tail -n 1 | awk '{print $2}')
if [ -z "$version" ]; then
echo "Error: Unable to fetch chart version" >&2
exit 1
fi
echo "Current chart version is: $version")
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)
new_chart_version="${major}.${minor}.$((patch + 1))"
echo "New chart version is: $new_chart_version"
echo "::set-output name=new_chart_version::$new_chart_version"
- name: Bump version in the related HelmChart Chart.yaml
uses: fjogeleit/yaml-update-action@main
with:
repository: KusionStack/charts
valueFile: 'charts/karpor/Chart.yaml'
propertyPath: '{"version":"${{ steps.get-chart-version.outputs.new_chart_version }}", "appVersion":"${{ steps.get_version.outputs.VERSION }}"}'
value: ${{ steps.get_version.outputs.VERSION }}
branch: bump-karpor-to-${{ steps.get_version.outputs.VERSION }}
targetBranch: test
createPR: false
message: 'refactor: bump karpor version to ${{ steps.get_version.outputs.VERSION }}'
token: ${{ secrets.GITHUB_TOKEN }}
workDir: .

- name: Log Test Outputs # Log outputs for debugging
run: |
echo "Testing complete. Check the logs for details."
echo "New chart version: ${{ steps.get_chart_version.outputs.new_chart_version }}"
echo "App version: ${{ steps.get_version.outputs.VERSION }}"

0 comments on commit 23efba5

Please sign in to comment.