Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions golang/publish/github.md.tmpl
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
The MongoDB Go Driver Team is pleased to release version {{ .ReleaseVersion }} of the official MongoDB Go Driver.

## Release Notes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should still keep the release notes section to highlight notable changes. For example, 1.17.4.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a "Release Highlights" section to signify that we want to use this for a couple of important changes included in the release.


This release {description of notable changes}.

### {Notable Release Feature 1}

{Description of notable release feature 1}

***
{{ .ChangeLog }}

For a full list of tickets included in this release, please see the [list of fixed issues](https://jira.mongodb.org/issues/?jql=project%3Dgodriver%20and%20fixVersion%3D{{ .ReleaseVersion }}).

**Full Changelog**: [v{{ .PreviousVersion }}...v{{ .ReleaseVersion }}](https://github.com/mongodb/mongo-go-driver/compare/v{{ .PreviousVersion }}...v{{ .ReleaseVersion }})
Copy link
Collaborator

@prestonvasquez prestonvasquez Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest we still include the full changelog, which is a comparison between the last release the current one. For example, 1.17.3..1.17.4. This is different than an enumerated list of changes as it provides a complete overview of all code changes for a release.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, meant to explain this on the PR itself. The changelog generated by GitHub always includes this, so this line is redundant. See this laravel-mongodb release to see what this looks like.


Documentation for the Go Driver can be found on [pkg.go.dev](https://pkg.go.dev/go.mongodb.org/mongo-driver/v2/mongo?tab=doc) and the [MongoDB documentation site](https://docs.mongodb.com/ecosystem/drivers/go/). BSON library documentation is also available on [pkg.go.dev](https://pkg.go.dev/go.mongodb.org/mongo-driver/v2/bson?tab=doc). Questions and inquiries can be asked on the [MongoDB Developer Community](https://www.mongodb.com/community/forums/tag/golang). Bugs can be reported in the [Go Driver project in the MongoDB JIRA](https://jira.mongodb.org/secure/CreateIssue!default.jspa?pid=14289) where a list of [current issues](https://jira.mongodb.org/browse/GODRIVER) can be found. Your feedback on the Go Driver is greatly appreciated!
10 changes: 8 additions & 2 deletions golang/publish/notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ var forumTmpl string
// for a Github release and writes it to a file named "github.md". It
// also prints the gh command to create a new draft release with those release
// notes.
func generateGithubNotes(release, previous string) {
func generateGithubNotes(release, previous, changeLogFile string) {
filename := "github.md"
changeLog, err := ioutil.ReadFile(changeLogFile)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ioutil is deprecated as of Go 1.16, suggest using os:

changelog, err := os.ReadFile(changeLogFile)

Copy link
Collaborator Author

@alcaeus alcaeus Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. Changed, thank you!

if err != nil {
log.Fatalf("Error reading file %q: %v", changeLogFile, err)
}

writeTemplate(
filename,
githubTmpl,
map[string]any{
"ReleaseVersion": release,
"PreviousVersion": previous,
"ChangeLog": string(changeLog),
})

fmt.Println()
Expand Down Expand Up @@ -88,6 +93,7 @@ func writeTemplate(filename, tmplText string, data any) {
func main() {
version := os.Args[1]
prevVersion := os.Args[2]
generateGithubNotes(version, prevVersion)
changeLogFile := os.Args[3]
generateGithubNotes(version, prevVersion, changeLogFile)
generateForumNotes(version)
}
40 changes: 27 additions & 13 deletions golang/publish/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,42 @@ else
fi
echo "DRY_RUN=$DRY_RUN" >> $GITHUB_ENV

# Generate notes
go run notes.go $VERSION $PREV_VERSION
cat forum.md >> $GITHUB_STEP_SUMMARY
rm forum.md

echo "---" >> $GITHUB_STEP_SUMMARY

NOTES_FILE=$(pwd)/github.md

# Handle GitHub Release
if [ "$PUSH_CHANGES" == "true" ]; then
pushd $GITHUB_WORKSPACE || exit 1
TITLE="MongoDB Go Driver ${VERSION}"
gh release create v${VERSION} --draft --verify-tag --title "$TITLE" -F $NOTES_FILE

# Create draft release with generated release notes
gh release create v${VERSION} --draft --verify-tag --title "$TITLE" --generate-notes

# Extract generated release notes to file
gh release view v${VERSION} --json body --template '{{ .body }}' >> changelog

NOTES_FILE=$(pwd)/changelog

popd || exit 1

# Generate release notes
go run notes.go $VERSION $PREV_VERSION $NOTES_FILE
cat forum.md >> $GITHUB_STEP_SUMMARY
rm forum.md

echo "---" >> $GITHUB_STEP_SUMMARY

NOTES_FILE=$(pwd)/github.md

pushd $GITHUB_WORKSPACE || exit 1

# Update release notes with generated version and upload release assets
gh release create v${VERSION} -F $NOTES_FILE
Copy link
Collaborator

@prestonvasquez prestonvasquez Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested double creates in a throw away repo and it doesn't appear to be an issue:

❯ gh release create v0.1.0-test --draft --verify-tag --title "Test v0.1.0-test" --generate-notes
https://github.com/prestonvasquez/dev/releases/tag/untagged-0390f16b8b624db14804
❯ gh release create v0.1.0-test --draft --verify-tag --title "Test v0.1.0-test" --generate-notes
https://github.com/prestonvasquez/dev/releases/tag/untagged-af4530f8c0cd95f7a56f

However, gh release also offers an edit option:

gh release edit v${VERSION} -F $NOTES_FILE

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I wanted to use, but apparently my copy/paste skills are a little rusty. Fixed now.

gh release upload v${VERSION} $RELEASE_ASSETS/*.*
JSON="url,tagName,assets,author,createdAt"
JQ='.url,.tagName,.author.login,.createdAt,.assets[].name'
echo "\## $TITLE" >> $GITHUB_STEP_SUMMARY
gh release view --json $JSON --jq $JQ v${VERSION} >> $GITHUB_STEP_SUMMARY

popd || exit 1
else
echo "## Skipping draft release with notes:" >> $GITHUB_STEP_SUMMARY
cat $NOTES_FILE >> $GITHUB_STEP_SUMMARY
echo "## Skipping draft release" >> $GITHUB_STEP_SUMMARY
fi
rm $NOTES_FILE
rm $NOTES_FILE
Loading