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

Upload assets when we create the release #25

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Apr 13, 2023

When we create the github release, upload the assets at the same time, so that github is responsible for apply the latest flag to the release and only applies latest when all assets are uploaded. Right now there is a delay between when the release is created and when the assets are available, which causes the "install latest" script to fail for a short period of time after a release is created. I looked into managing the latest flag ourselves, so that we can flip it after we upload the assets but gh is doing a lot of logic around if it's the most recent and highest semver tag, and I'd like to not replicate that logic.

In the past I have seen create release fail when uploading assets during release creation, which is why it was originally split into two steps. Now that the code is checking for the existence of the release and re-uploading assets, that shouldn't be a problem. If a release fails while uploading, it won't have latest applied yet to it and we can kick the build to retry the upload to the release. I am also ensuring that the release isn't still marked as a draft when we retry uploading the assets. If asset upload fails during release creation, the release is left in draft and the draft flag needs to be removed once we finish uploading the assets during retry.

I have also turned on automatic release note creation so that we don't need to do that manually after the release is finished.

This is the groundwork for getporter/porter#2723. It won't go live until we update our go.mod in each repository that uses this package though.

When we create the github release, upload the assets at the same time, so that github is responsible for apply the latest flag to the release and only applies latest when all assets are uploaded. Right now there is a delay between when the release is created and when the assets are available, which causes the "install latest" script to fail for a short period of time after a release is created. I looked into managing the latest flag ourselves, so that we can flip it after we upload the assets but gh is doing a lot of logic around if it's the most recent and highest semver tag, and I'd like to not replicate that logic.

In the past I have seen create release fail when uploading assets during release creation, which is why it was originally split into two steps. Now that the code is checking for the existence of the release and re-uploading assets, that shouldn't be a problem. If a release fails while uploading, it won't have latest applied yet to it and we can kick the build to retry the upload to the release. I am also ensuring that the release isn't still marked as a draft when we retry uploading the assets. If asset upload fails during release creation, the release is left in draft and the draft flag needs to be removed once we finish uploading the assets during retry.

I have also turned on automatic release note creation so that we don't need to do that manually after the release is finished.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs carolynvs marked this pull request as ready for review April 13, 2023 14:58
@carolynvs
Copy link
Member Author

cc @samjohnsonCF this will fix the release lag you noted in our shared release library used in Porter and the mixins/plugins. Feel free to review!

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
Copy link

@arschles arschles left a comment

Choose a reason for hiding this comment

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

This is really cool and LGTM. I haven't yet seen anyone using the GitHub CLI from within a github action. Very cool

@carolynvs carolynvs merged commit 4f470a5 into getporter:main Apr 13, 2023
@carolynvs carolynvs deleted the fix-release-asset-lag branch April 13, 2023 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants