-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance CI Workflow: Check for Version Bump and appVersion Changes (#44)
* feat: additional approval on Version change * fix: combine version bump check and approve by label * fix: adjust label name * fix: remove tag comparison * fix: base_ref * fix: some naming changes
- Loading branch information
Showing
1 changed file
with
46 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,46 @@ | ||
name: Check for new release | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, labeled] | ||
|
||
jobs: | ||
check_version_bump: | ||
name: Check For Relase | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Extract Chart appVersion | ||
id: extract_appversion | ||
run: | | ||
appversion=$(yq e '.appVersion' ./deployments/chart/Chart.yaml) | ||
echo "appversion=$appversion" >> $GITHUB_ENV | ||
# Check for changes in the appVersion between PR and base branch | ||
- name: Check for appVersion changes | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release') }} | ||
run: | | ||
echo "Checking for appVersion changes..." | ||
if git diff origin/${{ github.base_ref }} -- deployments/chart/Chart.yaml | grep -qe "^[+-]appVersion: "; then | ||
echo "appVersion has changed. Failing the job." | ||
exit 1 | ||
else | ||
echo "No appVersion changes detected." | ||
fi | ||
# Post warning comment if there is a failure | ||
- name: Post warning comment | ||
if: ${{ failure() }} | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: "⚠️ Warning: This PR will result in a new release because the `appVersion` in Chart.yaml has changed to `${{ env.appversion }}`. Please confirm before merging." |