Skip to content

Commit 7b940f8

Browse files
authored
Add MakeReleaseNotes task (#5017)
* Fix changelog discrepancies * Add new util methods * Add changelog data type * Add a MakeReleaseNotes task * Add support for the release notes task * Update the release workflow to use the new task * Update the publishing plugin tests * Add tests for the new task * Add missing copyrights * Fix typo * Catch whitespace + remove todo comment * Rename toPairOrNull and add comment about exception * Fix type in separateAt * Change capturedValue to firstCapturedValue * Added support for github link transforms * Add changelog format workflow * Fixed some bugs * Add some changes to the workflow for testing * Fix format in yml * Fix change-files version * Change depth of fetch in workflow * Trigger CI * Map changed files * trigger CI * try to fix EOF * See if removing EOF fixes it? * Add python script to handle changelog comment * Move to python script in workflow * trigger ci * Add setup python step * trigger ci * Fix arguments * Remove equals from params * trigger CI * Fix exit code * try to fix file location * Remove CI triggers * Add skipped entry for PR comment. * Rename workflow * Add EOF newline to workflow * Add other missing EOF * Update add-pr-comment * Stop using message-path * Test success message * Add skip for workflow * Utilize status * Move status * Use outcome * typo * trigger CI again * Add output file * try to use all files changed * Ignore buildSrc files * Fix typo * Allow workflow to continue on error * Add support for empty release notes * Remove CI trigger * Use unreleased instead of release for var name * NO_RELEASE_CHANGE * lock workflow to master
1 parent 9c2aa45 commit 7b940f8

File tree

33 files changed

+1489
-256
lines changed

33 files changed

+1489
-256
lines changed

.github/workflows/build-release-artifacts.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ jobs:
2626
run: |
2727
./gradlew firebasePublish
2828
29-
- name: Generate release notes
30-
run: |
31-
python3 docs/make_release_notes.py
32-
cd build/changelog && zip -r ../release_notes.zip android
33-
3429
- name: Upload generated artifacts
3530
uses: actions/upload-artifact@v2
3631
with:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release note changes
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Create output file
17+
run: touch changelog_comment.md
18+
19+
- name: Get changed changelog files
20+
id: changed-files
21+
uses: tj-actions/[email protected]
22+
with:
23+
files_ignore: |
24+
buildSrc/**
25+
files: |
26+
**/CHANGELOG.md
27+
28+
- name: Set up Python 3.10
29+
uses: actions/setup-python@v4
30+
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
31+
with:
32+
python-version: '3.10'
33+
34+
- name: Set up fireci
35+
id: install-fireci
36+
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
37+
run: pip3 install -e ci/fireci
38+
39+
- name: Generate comment
40+
id: generate-comment
41+
if: ${{ steps.install-fireci.outcome == 'success' }}
42+
run: |
43+
fireci changelog_comment -c "${{ steps.changed-files.outputs.all_changed_files }}" -o ./changelog_comment.md
44+
45+
- name: Add PR Comment
46+
uses: mshick/[email protected]
47+
continue-on-error: true
48+
with:
49+
status: ${{ steps.generate-comment.outcome }}
50+
message-path: ./changelog_comment.md
51+
message-skipped: |
52+
## Release note changes
53+
No release note changes were detected. If you made changes that should be
54+
present in the next release, ensure you've added an entry in the appropriate
55+
`CHANGELOG.md` file(s).
56+
message-failure: |
57+
## Release note changes
58+
A `CHANGELOG.md` file seems to not match the expected format.
59+
Please ensure your changelog files are following the format as
60+
defined in [our documentation](#).

buildSrc/src/main/java/com/google/firebase/gradle/plugins/BaseFirebaseLibraryPlugin.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ import org.gradle.kotlin.dsl.register
3232
import org.w3c.dom.Element
3333

3434
abstract class BaseFirebaseLibraryPlugin : Plugin<Project> {
35+
protected fun registerMakeReleaseNotesTask(project: Project) =
36+
project.tasks.register<MakeReleaseNotesTask>("makeReleaseNotes") {
37+
val changelog = project.file("CHANGELOG.md")
38+
val releaseNotes by tempFile("release_notes.md")
39+
40+
onlyIf("Changelog file not found.") { changelog.exists() }
41+
42+
changelogFile.set(changelog)
43+
releaseNotesFile.set(releaseNotes)
44+
}
3545

3646
protected fun kotlinModuleName(project: Project): String {
3747
val fullyQualifiedProjectPath = project.path.replace(":".toRegex(), "-")

0 commit comments

Comments
 (0)