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: upload assets to GitHub release #334

Merged
merged 8 commits into from
Oct 16, 2019

Conversation

uetchy
Copy link
Contributor

@uetchy uetchy commented Oct 14, 2019

Adding support for uploading assets to GitHub release.

Fixes #332

@eunjae-lee
Copy link
Contributor

Now that I see your code, I feel like we need to change assetsToUpload to a function returning an array.
The assets to upload can be different from versions. For example, if your bundle is like my-lib-1.2.3.zip, then assetsToUpload needs to dynamically return the file name.

releases: {
  assetsToUpload: ({ version, dir }) => []
}

What do you think? Do you find any other parameters useful there besides version and dir?

@uetchy
Copy link
Contributor Author

uetchy commented Oct 14, 2019

Seems nice! I'm figuring tagName is also useful.

Another possible option is to accept glob pattern.

releases: {
  assetsToUpload: "dist/*.zip"
}

Those options can be considered.

  1. singular file, list, function
  2. singular file (glob), list (glob)
  3. singular file (glob), list (glob), function

@eunjae-lee
Copy link
Contributor

  1. singular file, list, function
  2. singular file (glob), list (glob)
  3. singular file (glob), list (glob), function

3 sounds complete, but you could do 1 first and 3 later if it's too big for you to work on at the moment.

@uetchy
Copy link
Contributor Author

uetchy commented Oct 15, 2019

added

@uetchy uetchy closed this Oct 15, 2019
@uetchy uetchy deleted the features/upload-assets branch October 15, 2019 05:43
@uetchy uetchy restored the features/upload-assets branch October 15, 2019 05:43
@uetchy uetchy reopened this Oct 15, 2019
@uetchy
Copy link
Contributor Author

uetchy commented Oct 15, 2019

assetsToUpload accepts both Function and Promises.

@eunjae-lee
Copy link
Contributor

@uetchy
Nice work! It looks good to me.
Can you test one thing?
I'm worried if it won't work when any of path contains a space.
For example, there's a file named /path/hello world.zip, and the command will become
hub release create -a /path/hello world.zip -a /another/file.zip
That space needs to be escaped, but not sure how to properly do it, covering cross platforms.

@uetchy
Copy link
Contributor Author

uetchy commented Oct 16, 2019

@eunjae-lee OK now I added shell-quote to quote asset path containing spaces.
And also wrote a test for them.

It should be cross-platform ready now.

@eunjae-lee eunjae-lee merged commit fcf2807 into algolia:master Oct 16, 2019
@eunjae-lee
Copy link
Contributor

Congrats and thanks for your contribution. I really appreciate it 🙂

@uetchy uetchy deleted the features/upload-assets branch October 17, 2019 00:40
@uetchy
Copy link
Contributor Author

uetchy commented Oct 17, 2019

Awesome😎

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.

Upload assets to GitHub release
2 participants