Fix: Empty changelog groups, silent-skip on empty release, and publis… #31
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
| name: Publish | |
| on: | |
| push: | |
| branches: ['master', 'main'] | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/build-workflow.yml | |
| release: | |
| needs: build | |
| name: Create Release | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: gradle/actions/setup-gradle@v6 | |
| - name: Download build | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: build | |
| path: build | |
| - name: Release | |
| uses: docker://antonyurchenko/git-release:v6.0.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RELEASE_NAME: ${{ needs.build.outputs.version }} | |
| PRE_RELEASE: ${{ github.ref_type == 'branch' }} | |
| UNRELEASED: ${{ github.ref_type == 'branch' && 'update' || '' }} | |
| UNRELEASED_TAG: latest-snapshot | |
| ALLOW_EMPTY_CHANGELOG: ${{ github.ref_type == 'branch' && 'true' || 'false' }} | |
| with: | |
| args: | | |
| build/*.jar | |
| - name: Check for tagged release | |
| id: check_tag | |
| run: | | |
| if git tag --points-at HEAD | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "is_release_tag=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_release_tag=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Gradle Publish | |
| # Both a branch push and its accompanying tag push trigger this workflow from the | |
| # same release. Skip the branch-triggered run when it's also sitting on a release | |
| # tag, so only the tag-triggered run publishes (avoids a duplicate-version 409). | |
| if: ${{ !(github.ref_type == 'branch' && steps.check_tag.outputs.is_release_tag == 'true') }} | |
| run: ./gradlew publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |