Skip to content

Commit 1286fea

Browse files
committed
Configure Changelog workflow
To auto-generate release notes for each release.
1 parent 9e3487d commit 1286fea

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/release-drafter.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name-template: $RESOLVED_VERSION
2+
tag-template: v$RESOLVED_VERSION
3+
categories:
4+
- title: 🚀 Features
5+
labels:
6+
- "type: enhancement"
7+
- "type: new feature"
8+
- "type: major"
9+
- title: 🚀 Bug Fixes/Improvements
10+
labels:
11+
- "type: improvement"
12+
- "type: bug"
13+
- "type: minor"
14+
- title: 🛠 Dependency upgrades
15+
labels:
16+
- "type: dependency upgrade"
17+
- "dependencies"
18+
- title: ⚙️ Build/CI
19+
labels:
20+
- "type: ci"
21+
- "type: build"
22+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
23+
filter-by-commitish: true
24+
version-resolver:
25+
major:
26+
labels:
27+
- 'type: major'
28+
minor:
29+
labels:
30+
- 'type: minor'
31+
patch:
32+
labels:
33+
- 'type: patch'
34+
default: patch
35+
template: |
36+
## What's Changed
37+
38+
$CHANGES
39+
40+
## Contributors
41+
42+
$CONTRIBUTORS
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Changelog
2+
on:
3+
issues:
4+
types: [closed,reopened]
5+
push:
6+
branches:
7+
- '[2-9]+.[0-9]+.x'
8+
workflow_dispatch:
9+
jobs:
10+
release_notes:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Check if it has release drafter config file
15+
id: check_release_drafter
16+
run: |
17+
has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false")
18+
echo ::set-output name=has_release_drafter::${has_release_drafter}
19+
- name: Extract branch name
20+
id: extract_branch
21+
run: echo ::set-output name=value::${GITHUB_REF:11}
22+
# If it has release drafter:
23+
- uses: release-drafter/release-drafter@v5
24+
if: steps.check_release_drafter.outputs.has_release_drafter == 'true'
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
27+
with:
28+
commitish: ${{ steps.extract_branch.outputs.value }}
29+
# Otherwise:
30+
- name: Export Gradle Properties
31+
if: steps.check_release_drafter.outputs.has_release_drafter == 'false'
32+
uses: micronaut-projects/github-actions/export-gradle-properties@master
33+
- uses: micronaut-projects/github-actions/release-notes@master
34+
if: steps.check_release_drafter.outputs.has_release_drafter == 'false'
35+
id: release_notes
36+
with:
37+
token: ${{ secrets.GH_TOKEN }}
38+
- uses: ncipollo/release-action@v1
39+
if: steps.check_release_drafter.outputs.has_release_drafter == 'false' && steps.release_notes.outputs.generated_changelog == 'true'
40+
with:
41+
allowUpdates: true
42+
commit: ${{ steps.release_notes.outputs.current_branch }}
43+
draft: true
44+
name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }}
45+
tag: v${{ steps.release_notes.outputs.next_version }}
46+
bodyFile: CHANGELOG.md
47+
token: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)