Skip to content

Commit

Permalink
Handle release already existing when uploading release notes
Browse files Browse the repository at this point in the history
Previously, the uploading of release notes assumed that the release
didn't exist yet. This 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.
  • Loading branch information
SeanTAllen committed Jan 28, 2025
1 parent a7e06a2 commit aa8a9ce
Showing 1 changed file with 8 additions and 1 deletion.
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)

0 comments on commit aa8a9ce

Please sign in to comment.