-
Notifications
You must be signed in to change notification settings - Fork 30
feat: 187 automatically create new release each time a json schema change is merged #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
qcdyx
merged 3 commits into
master
from
187-automatically-create-new-release-each-time-a-json-schema-change-is-merged
Dec 24, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,60 @@ | ||
| name: Auto Release on Schema Changes | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| release: | ||
| if: github.event.pull_request.merged == true | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository (full history + tags) | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Detect schema changes in versioned folders | ||
| run: | | ||
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | ||
| MERGE_SHA="${{ github.sha }}" | ||
|
|
||
| echo "Base SHA: $BASE_SHA" | ||
| echo "Merge SHA: $MERGE_SHA" | ||
|
|
||
| changed_files=$(git diff --name-only "$BASE_SHA" "$MERGE_SHA") | ||
|
|
||
| echo "Changed files:" | ||
| echo "$changed_files" | ||
|
|
||
| # Root-level vX.X folders only | ||
| if echo "$changed_files" | grep -qE '^v[0-9]+\.[0-9]+/'; then | ||
| echo "Schema changes detected in versioned folders." | ||
| echo "release_needed=true" >> $GITHUB_ENV | ||
| else | ||
| echo "No schema changes detected." | ||
| echo "release_needed=false" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Determine next version | ||
| if: env.release_needed == 'true' | ||
| run: | | ||
| latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | ||
| echo "Latest tag: $latest_tag" | ||
|
|
||
| new_version=$(echo "$latest_tag" | awk -F. -v OFS=. '{$NF++; print}') | ||
| echo "New version: $new_version" | ||
|
|
||
| echo "new_version=$new_version" >> $GITHUB_ENV | ||
|
|
||
| - name: Create GitHub Release | ||
| if: env.release_needed == 'true' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release create "$new_version" \ | ||
| --title "Release $new_version" \ | ||
| --notes "Automatic release triggered by changes to versioned schema folders." | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider using a push to master trigger instead?
See this as an example
One advantage is that you can restrict the trigger only to changes in specified folders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes — using a push trigger with paths would work, but I opted for a pull_request: closed trigger to ensure releases only happen after an explicit PR merge and to avoid accidental releases from direct pushes.