Skip to content

Commit

Permalink
ci: Auto-generate and publish release notes for minor releases (micro…
Browse files Browse the repository at this point in the history
…soft#22514)

The transform:releaseNotes command was added in microsoft#22466 to enable
automated release note creation for minor releases. This change updates
the CI pipeline to take advantage of the new capabilities.


[AB#19242](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/19242)

---------

Co-authored-by: Alex Villarreal <[email protected]>
  • Loading branch information
tylerbutler and alexvy86 authored Oct 10, 2024
1 parent 6d00fc7 commit 1bc44ec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/data/release-notes-issue-intro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ pnpm flub generate releaseNotes -g client -t minor --outFile RELEASE_NOTES/{{ ve
pnpm flub generate releaseNotes -g client -t minor --headingLinks --excludeH1 --outFile temporary-file.md
```

You can then copy and paste the contents of the `temporary-file.md` into the GitHub Release.
This should happen automatically as part of the release process, but if you need to generate the release notes manually, you can use the above command.

---
46 changes: 26 additions & 20 deletions .github/workflows/push-tag-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: "push-tag-create-release"
# When a release tag is pushed to the repo, this workflow is triggered. It first installs the Fluid build-tools, then
# uses the flub release fromTag command to load some release metadata into an environment variable. Once loaded, it
# checks out the tagged commit and runs flub release report to generate release reports. It also uses auto-changelog to
# create a changelog for patch releases (only patches). All the artifacts are uploaded for debugging purposes.
# create a changelog for patch releases, and uses the in-repo release notes for minor and major releases.

# Once the artifacts are created, the workflow creates a GitHub release and attaches the release reports to it. The
# release is a draft so that the release engineer can verify the contents before publishing.
# Once the artifacts are created, the workflow creates a GitHub release and attaches the release reports to it. Client
# and server releases are published automatically, but all others are published as a draft and must be manually
# published using the GitHub UI.

on:
push:
Expand Down Expand Up @@ -72,7 +73,9 @@ jobs:
with:
name: release-metadata
path: release-metadata.json
retention-days: 3
# We release every few weeks, so this helps ensure that an artifact is available for debugging this workflow
# since we are likely to release within a 30 day window.
retention-days: 30
- name: Load release metadata into env variable
run: |
echo "RELEASE_JSON=$(cat release-metadata.json)" >> $GITHUB_ENV
Expand Down Expand Up @@ -101,10 +104,20 @@ jobs:
path: reports
retention-days: 7

# Generate changelog
- name: Generate changelog
# This changelog is only for client patch releases and build-tools releases
if: (fromJson(env.RELEASE_JSON).releaseType == 'patch' && fromJson(env.RELEASE_JSON).packageOrReleaseGroup == 'client') || fromJson(env.RELEASE_JSON).packageOrReleaseGroup == 'build-tools'
- name: Generate minor/major release notes
# This content is the "default" release notes - this should be used for minor and major releases of client and
# server release groups. To use this, a release group needs to be using changesets. Build-tools does not use
# changesets, so it is excluded.
if: fromJson(env.RELEASE_JSON).releaseType != 'patch' && (fromJson(env.RELEASE_JSON).packageOrReleaseGroup == 'client' || fromJson(env.RELEASE_JSON).packageOrReleaseGroup == 'server')
run: |
flub transform releaseNotes \
--inFile RELEASE_NOTES/${{ fromJson(env.RELEASE_JSON).version }}.md \
--outFile release-notes.md
- name: Generate patch release notes
# This condition is the logical inverse of the condition for the "Generate minor/major release notes" step.
# One of these two steps should be executed each time the workflow is run.
if: fromJson(env.RELEASE_JSON).releaseType == 'patch' || (fromJson(env.RELEASE_JSON).packageOrReleaseGroup != 'client' && fromJson(env.RELEASE_JSON).packageOrReleaseGroup != 'server')
run: |
# We only need the root dependencies
pnpm install -w --frozen-lockfile
Expand All @@ -114,13 +127,8 @@ jobs:
--starting-version ${{ fromJson(env.RELEASE_JSON).tag }} \
--ending-version ${{ fromJson(env.RELEASE_JSON).tag }} \
--tag-prefix ${{ fromJson(env.RELEASE_JSON).packageOrReleaseGroup }}_v \
--output auto-changelog.md \
--output release-notes.md \
--template .github/workflows/data/patch-changelog.hbs
- name: Generate changelog
# This changelog is a basically empty one used for everything except client patches and build-tools.
if: ${{ !(fromJson(env.RELEASE_JSON).releaseType == 'patch' && fromJson(env.RELEASE_JSON).packageOrReleaseGroup == 'client') && fromJson(env.RELEASE_JSON).packageOrReleaseGroup != 'build-tools' }}
run: |
echo "This is a **${{ fromJson(env.RELEASE_JSON).releaseType }}** release." > auto-changelog.md
# Only creates GH releases for client, server, and build-tools releases.
- name: Create GH release
Expand All @@ -133,10 +141,8 @@ jobs:
# Will skip if a published (non-draft) release already exists.
skipIfReleaseExists: true

# If the release is NOT a patch, leave it as a draft. Only patch releases are auto-published because their
# auto-generated release notes are sufficient for those releases. Minor and major releases currently require
# some curation of the release notes.
draft: ${{ fromJson(env.RELEASE_JSON).releaseType != 'patch' }}
# Leave all releases except for client/server as draft; only client and server releases are fully automated.
draft: ${{ fromJson(env.RELEASE_JSON).packageOrReleaseGroup != 'client' && fromJson(env.RELEASE_JSON).packageOrReleaseGroup != 'server' }}

# Don't change the draft state when updating an existing release. This setting is not really necessary for us
# in most cases because we don't pre-create releases, so this workflow always creates a new GH release. It's
Expand All @@ -146,8 +152,8 @@ jobs:
name: ${{ fromJson(env.RELEASE_JSON).title }}
omitNameDuringUpdate: false # always overwrite the name

# Created in the "Generate changelog" step
bodyFile: auto-changelog.md
# Created in the "Generate release notes" step(s)
bodyFile: release-notes.md
omitBodyDuringUpdate: true # Don't overwrite the body

# Created in the "Create release reports (manifests)" step
Expand Down

0 comments on commit 1bc44ec

Please sign in to comment.