Skip to content

Commit cb4463f

Browse files
committed
Change: Replace git-release Docker action with gh release + getChangelog (#10)
antonyurchenko/git-release hasn't been updated since Jan 2024 and ran its own independent Keep a Changelog parser, separate from the one already configured via org.jetbrains.changelog for patching. Using two different parsers for the same file risked them disagreeing on what counts as a valid section. Replaced it with plain `gh release create`/`gh release delete` (already available on runners, no Docker pull), fed by the changelog plugin's own `getChangelog` task: - Tag-triggered runs: `getChangelog --project-version=X` extracts that version's notes, `gh release create` publishes the tagged release. - Branch-triggered runs: `getChangelog --unreleased` extracts the current Unreleased content, and the `latest-snapshot` pre-release is deleted and recreated pointing at the new commit (same "update in place" behavior git-release provided via PRE_RELEASE/UNRELEASED). Verified `getChangelog --no-header --output-file` locally for both the --project-version and --unreleased cases against the real changelog: clean section content, no header line, no reference-link footer - ready to use directly as release notes.
1 parent 8e78c9a commit cb4463f

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/publish-workflow.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,25 @@ jobs:
2323
with:
2424
name: build
2525
path: build
26-
- name: Release
27-
uses: docker://antonyurchenko/git-release:v6.0.0
26+
- name: Extract release notes
27+
run: |
28+
if [ "${{ github.ref_type }}" = "tag" ]; then
29+
./gradlew getChangelog --console=plain -q --no-header --project-version="${{ needs.build.outputs.version }}" --output-file=build/release-notes.md
30+
else
31+
./gradlew getChangelog --console=plain -q --no-header --unreleased --output-file=build/release-notes.md
32+
fi
33+
- name: Create GitHub release for tag
34+
if: ${{ github.ref_type == 'tag' }}
35+
run: gh release create "${{ github.ref_name }}" build/*.jar --title "${{ needs.build.outputs.version }}" --notes-file build/release-notes.md
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Update latest-snapshot pre-release
39+
if: ${{ github.ref_type == 'branch' }}
40+
run: |
41+
gh release delete latest-snapshot --yes --cleanup-tag || true
42+
gh release create latest-snapshot build/*.jar --title "${{ needs.build.outputs.version }}" --prerelease --notes-file build/release-notes.md --target "${{ github.sha }}"
2843
env:
2944
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
RELEASE_NAME: ${{ needs.build.outputs.version }}
31-
PRE_RELEASE: ${{ github.ref_type == 'branch' }}
32-
UNRELEASED: ${{ github.ref_type == 'branch' && 'update' || '' }}
33-
UNRELEASED_TAG: latest-snapshot
34-
ALLOW_EMPTY_CHANGELOG: ${{ github.ref_type == 'branch' && 'true' || 'false' }}
35-
with:
36-
args: |
37-
build/*.jar
3845
- name: Check for tagged release
3946
id: check_tag
4047
run: |

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Changed
5+
- Replace the `antonyurchenko/git-release` Docker action with `gh release create`/`gh release delete`, using the `org.jetbrains.changelog` plugin's `getChangelog` task to extract release notes instead of a separate third-party changelog parser
6+
47
### Fixed
58
- Changelog plugin no longer pre-populates the new Unreleased section with empty Keep a Changelog group headers
69
- Release hook now fails loudly (instead of silently skipping the whole release) if the Unreleased section has no content when a release runs

0 commit comments

Comments
 (0)