tcnksm / ghr

Upload multiple artifacts to GitHub Release in parallel

Home Page:http://tcnksm.github.io/ghr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use of closed file

tcurdt opened this issue · comments

I am trying to test the re-upload of a release

WARNING: found release (v0.0.5). Use existing one.
--> Uploading:  foo-v0.0.5.tgz
Failed to upload one of assets: one of the goroutines failed: failed to upload asset: /Users/tcurdt/Desktop/base-ci/dist/foo-v0.0.5.tgz: failed to upload release asset: /Users/tcurdt/Desktop/base-ci/dist/foo-v0.0.5.tgz: stat /Users/tcurdt/Desktop/base-ci/dist/foo-v0.0.5.tgz: use of closed file
$ ll /Users/tcurdt/Desktop/base-ci/dist/foo-v0.0.5.tgz
-rw-r--r--  1 tcurdt  staff  209 Jul  4 17:07 /Users/tcurdt/Desktop/base-ci/dist/foo-v0.0.5.tgz

Honestly I have no clue what that error message is trying to tell me. "use of closed file"?

I figured I delete the asset on github and try again - which then worked.

So I see two issues:

  1. A better error message
  2. Support for replacing a release (asset)

Hi @tcurdt,

Have you tried with -replace or -recreate options? Check the help page:

$ ghr -h
Usage: ghr [options...] TAG PATH

ghr is a tool to create Release on Github and upload your
artifacts to it. ghr parallelizes upload of multiple artifacts.

You must specify tag (e.g., v1.0.0) and PATH to local artifacts.
If PATH is directory, ghr globs all files in the directory and
upload it. If PATH is a file then, upload only it.

And you also must provide GitHub API token which has enough permission
(For a private repository you need the 'repo' scope and for a public
repository need 'public_repo' scope). You can get token from GitHub's
account setting page.

You can use ghr on GitHub Enterprise. Set base URL via GITHUB_API
environment variable.

Options:

  -username, -u      Github repository owner name. By default, ghr
                     extracts it from global gitconfig value.

  -repository, -r    GitHub repository name. By default, ghr extracts
                     repository name from current directory's .git/config.

  -token, -t         GitHub API Token. By default, ghr reads it from
                     'GITHUB_TOKEN' env var.

  -parallel=-1       Parallelization factor. This option limits amount
                     of parallelism of uploading. By default, ghr uses
                     number of logic CPU.

  -recreate          Recreate release if it already exists. If want to
                     upload to same release and replace use '-replace'.

  -replace           Replace artifacts if it is already uploaded. ghr
                     thinks it's same when local artifact base name
                     and uploaded file name are same.

Thanks for the pointer. I don't think I tried. But my main gripe is the useless error message. It should be better no matter what.

Fixed at #99