diff --git a/.github/workflows/publish-workflow.yml b/.github/workflows/publish-workflow.yml index e3c2a64..7c0dd2b 100644 --- a/.github/workflows/publish-workflow.yml +++ b/.github/workflows/publish-workflow.yml @@ -16,6 +16,7 @@ jobs: - 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 @@ -34,7 +35,19 @@ jobs: 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 }} diff --git a/CHANGELOG.md b/CHANGELOG.md index c7f33c4..67f417d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,10 @@ # Changelog ## [Unreleased] - -### Added - -### Changed - -### Deprecated - -### Removed - ### Fixed - -### Security +- Changelog plugin no longer pre-populates the new Unreleased section with empty Keep a Changelog group headers +- Release hook now fails loudly (instead of silently skipping the whole release) if the Unreleased section has no content when a release runs +- Publish workflow's registry publish step is skipped on the branch-triggered run when it's also sitting on a release tag, avoiding a duplicate-version 409 against the tag-triggered run ## [0.3.0] - 2026-07-22 diff --git a/build.gradle.kts b/build.gradle.kts index fc7ec19..2e9b2d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,7 +33,7 @@ scmVersion { changelog { repositoryUrl.set("https://github.com/dotRun/MCVotifierLib") - groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security")) + groups.set(emptyList()) } fun patchChangelogToVersion(newVersion: String) { @@ -43,6 +43,7 @@ fun patchChangelogToVersion(newVersion: String) { .apply { version.set(newVersion) header.set("$newVersion - ${date()}") + patchEmpty.set(false) }.run() }