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

feat: add existing_release option #26

Closed
wants to merge 1 commit into from
Closed

feat: add existing_release option #26

wants to merge 1 commit into from

Conversation

jef
Copy link

@jef jef commented Sep 29, 2022

Description

With the current logic, if we have release titles different from "${GITHUB_REPOSITORY#*/} ${tag#v}", we create another release. I figured it would be better if the user knew they wanted to either a) create a release or b) upload to an existing release.

@mislav
Copy link
Contributor

mislav commented Oct 17, 2022

Hi, there is already this logic. If that doesn't work like it should, let's fix it without adding a new feature:

if ! gh release create "$tag" $prerelease --title="${GITHUB_REPOSITORY#*/} ${tag#v}" --generate-notes -- "${assets[@]}"; then
echo "trying to upload assets to an existing release instead..."
gh release upload "$tag" --clobber -- "${assets[@]}"

The logic is as follows:

  • Try to create release with tag name that is determined from GITHUB_REF, which is usually refs/tags/v1.2.3, which is usually populated by you pushing a git tag v1.2.3 to your repo;
  • If creating a release failed for some reason, assume that there is already a release for tag v1.2.3 (it doesn't matter what its title is) and try uploading the binaries there;
  • If something else was wrong, like GitHub service for example being down, then just let the whole thing abort;
  • Existing releases are looked up by the tag name property, not the release title property. You can title your release any way you want.

@gabe565
Copy link
Contributor

gabe565 commented Oct 18, 2022

Hi, there is already this logic. If that doesn't work like it should, let's fix it without adding a new feature:

I'm using this logic in gabe565/gh-profile and can confirm it works, but I end up with a draft release that I have to delete each time the action runs.

Instead, would it make sense to check if there's an existing release before creating a draft? I could open a PR that checks the output of gh release view TAG >/dev/null.

Edit: Went ahead and created a PR for this. See #28.

@jef
Copy link
Author

jef commented Oct 19, 2022

Superseded by #28

@jef jef closed this Oct 19, 2022
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.

3 participants