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

hub-release option for overwrite on attach #2657

Open
DanySK opened this issue Dec 1, 2020 · 5 comments
Open

hub-release option for overwrite on attach #2657

DanySK opened this issue Dec 1, 2020 · 5 comments
Labels

Comments

@DanySK
Copy link

DanySK commented Dec 1, 2020

The problem I'm trying to solve:

I'd like to be able to use hub to refresh the artifacts for some existing release.
This is especially useful in CI, I'd like to be able to create a release if non existing, then upload the file if they are not there already, or if they are different than the ones produced by the latest CI run.

How I imagine hub could expose this functionality:

hub release edit -a FILE --overwrite TAG

@DanySK DanySK added the feature label Dec 1, 2020
@mislav
Copy link
Owner

mislav commented Dec 1, 2020

@DanySK Thanks for the feature request!

I'd like to be able to create a release if non existing

Is it an option for you to try to fetch an existing release first, then create one if missing?

if hub release show TAG >/dev/null; then
  hub release edit TAG -a FILE
else
  hub release create TAG -a FILE
fi

Existing release assets that match FILE will automatically be deleted when another is re-uploaded (even if they share the same contents).

@DanySK
Copy link
Author

DanySK commented Dec 1, 2020

It does cover most of the cases indeed, yet if I need to re-upload a new version of the same file I can't do so.
For now I'm working this around using GH CLI and uploading using the --clobber option, so I'm using hub for creating the release if non existent and gh to upload files once created.

Is there any reason I should be consistent and use a single tool?

@mislav
Copy link
Owner

mislav commented Dec 3, 2020

yet if I need to re-upload a new version of the same file I can't do so.

That sounds weird to me. If I'm reading hub's implementation of UploadReleaseAssets, it should delete all existing assets of the same name before uploading new ones. Therefore, hub release edit -a myfile.tgz should always work, even if the release already has myfile.tgz uploaded. Is this not your experience?

Any reason why you couldn't just use gh to cover your entire releasing flow?

@DanySK
Copy link
Author

DanySK commented Dec 3, 2020

Here is a build where the command fails, my understanding was that the artifact had been uploaded already.

Anyway, no problem for me at using hub, gh, or mix both, as far as they are available on GitHub Actions.

@mislav
Copy link
Owner

mislav commented Dec 4, 2020

@DanySK Thanks for that info. It appears that there is a bug with re-uploading assets in hub.

You may want to try gh instead. The gh release create command is similar to hub (still, read its help for flag name differences), but the command to upload the file would be:

gh release upload "$TAG" --clobber "$pdf"

@mislav mislav added bug and removed feature labels Dec 4, 2020
DanySK added a commit to AlchemistSimulator/Alchemist that referenced this issue Jan 11, 2021
DanySK added a commit to Protelis/Protelis that referenced this issue Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants