Skip to content

Commit

Permalink
Automatically draft release notes on maintenance branches push (#2872)
Browse files Browse the repository at this point in the history
This commit introduces Release-Drafter in a dedicated workflow,
for pushes categorized as "SNAPSHOT" (ie corresponding to the merging of
a PR).

The use of `filter-by-commitish` in the config and `commitish` (set to
the target branch) in the action config should ensure that drafts are
created for both the `main` branch and older maintenance branches.

Fixes #1445.
  • Loading branch information
simonbasle committed Jan 5, 2022
1 parent 4926eb7 commit a9993c3
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: ':warning: Update considerations and deprecations'
labels:
- 'warn/api-change'
- 'warn/behavior-change'
- 'warn/blocker'
- 'warn/deprecation'
- 'warn/regression'
- title: ':sparkles: New features and improvements'
label: 'type/enhancement'
- title: ':lady_beetle: Bug fixes'
label: 'type/bug'
- title: ':book: Documentation, Tests and Build'
labels:
- 'type/chores'
- 'type/documentation'
- title: ':up: Dependency Upgrades'
label: 'type/dependency-upgrade'
change-template: '- $TITLE'
exclude-contributors:
- 'simonbasle'
- 'OlegDokuka'
- 'violetagg'
- 'pderop'
- 'garyrussel'
- 'acogoluegnes'
filter-by-commitish: true
template: |
# :checklist: TODO below
- [ ] Replace release train references
- [ ] Replace older maintenance train references
- [ ] Ensure changes from other maintenance release are indeed grouped and extra-indented
${{ github.event.repository.name }} `$RESOLVED_VERSION` is part of **`2020.0.{SR}` Release Train (`Europium` SR{SR})**.
This release contains {SHORT DESCRIPTION OF THE CONTENTS}.
All changes from [`{OLDER_TRAIN}`](https://github.com/${{ github.repository }}/releases/tag/v{OLDER_TRAIN}) are also included and these are listed below with an additional level of indentation.
$CHANGES
## :+1: Thanks to all contributors who participated to this release
$CONTRIBUTORS
37 changes: 37 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Notes Drafter
on:
push:
branches: # For branches, better to list them explicitly than regexp include
- main
- 3.3.x
jobs:
releaseDraft:
# Note this job has no access to secrets, only github token. When possible we favor plain run of gradle tasks.
name: release-draft
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: setup java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 8
- name: interpret version
id: version
#we only run the qualifyVersionGha task so that no other console printing can hijack this step's output
#output:
# versionType: ${{ steps.version.outputs.versionType }}
# fullVersion: ${{ steps.version.outputs.fullVersion }}
#fails if versionType is BAD, which interrupts the workflow
run: ./gradlew qualifyVersionGha
- name: compile release notes
# Renovate Bot should suggest updates to the action
uses: release-drafter/[email protected]
id: notes
#draft release notes only if this is a snapshot commit (ie. a merge of a PR)
if: steps.version.outputs.versionType == 'SNAPSHOT'
with:
disable-autolabeler: true
commitish: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions gradle/setup.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ task qualifyVersionGha() {
println "::error ::Unable to parse $version to a VersionNumber with recognizable qualifier"
throw new TaskExecutionException(tasks.getByName("qualifyVersionGha"), new IllegalArgumentException("Unable to parse $version to a VersionNumber with recognizable qualifier"))
}
println "Recognized $version as $versionType"
}
}

Expand Down

0 comments on commit a9993c3

Please sign in to comment.