Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle release already existing when uploading release notes #83

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions .release-notes/83.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Handle release already existing when uploading release notes

Previously, the uploading of release notes assumed that the release didn't exist yet. If the release already existed, the release notes upload would fail.

Only working when a release didn't exist made sense for all our ponylang usage. However, for other projects that create assets as part of the build process and store them in GitHub releases rather than Cloudsmith, the release might already exist.

Now, we will check to see if the release exists. If it does, we update it with our release notes. If it doesn't, we will create the release like we previously did.
9 changes: 8 additions & 1 deletion scripts/publish-release-notes-to-github
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,12 @@ g = Github(os.environ['RELEASE_TOKEN'])
repo = g.get_repo(os.environ['GITHUB_REPOSITORY'])

print(INFO + "Uploading release notes..." + ENDC)
repo.create_git_release(version, version, release_notes)
# check to see if the release already exists
ghrelease = repo.get_release(version)
if ghrelease:
print(INFO + "Release already exists. Updating release notes." + ENDC)
ghrelease.update_release(name=version, message=release_notes)
else:
print(INFO + "Release does not exist. Creating release notes." + ENDC)
repo.create_git_release(version, version, release_notes)
print(INFO + "Release notes uploaded." + ENDC)