0xazure / supernova

Tool for exporting GitHub stars as an organized list.
Apache License 2.0
3 stars 3 forks source link

feat: Automatically publish artifacts to GitHub #18

Closed seanprashad closed 5 years ago

seanprashad commented 6 years ago

Fixes #17: Automatically publish artifacts to GitHub

This PR allows successful Travis builds to publish the target/release directory to Github releases for Supernova.

seanprashad commented 6 years ago

Travis docs for GitHub releases uploading contains more details on configuration options.

seanprashad commented 5 years ago

TODO: Test this on one of my own repos by creating a tag and having Travis build and upload the release.

seanprashad commented 5 years ago

I haven't forgotten about this - just have my ✋ ✋ tied with other coursework right now

0xazure commented 5 years ago

No worries! Thanks for the update.

0xazure commented 5 years ago

Hey @SeanPrashad, just wanted to check in and see how this pull request is going.

0xazure commented 5 years ago

We were discussing the encrypted API token to enable direct upload of build artifacts to GitHub, and I think we might be better served by defining this kind of credential in the repository settings, especially because it's a value that should probably not be automatically available to forks as only the upstream master branch should upload build artifacts automatically.

@SeanPrashad let me know what you think the best direction would be, and a name for the env var, I can get it added to the repository settings a lot more quickly than creating & encrypting it before sending to you and it should be available immediately on this pull request so you can test it out.

seanprashad commented 5 years ago

Sweet - I think the repo setting will be just as good. Can we use GH_TOKEN for the name? That will replace this:

GH_TOKEN: &GH_TOKEN
script:
    secure:

with this:

api_key: `GH_TOKEN`

I'll also beef up the conditional settings for when we are going to deploy by adding repo: 0xazure/supernova. This means that a release will only get deployed if:

  1. The current checked out branch is master
  2. The repo is 0xazure/supernova
  3. A new tag is added to a commit on master and pushed to 0xazure/supernova (git push --tag origin). This will trigger a build to deploy artifacts from Travis
seanprashad commented 5 years ago

https://github.com/SeanPrashad/supernova/releases 🎉

image

seanprashad commented 5 years ago

@0xazure I know testing this patch will be quite tricky which is why I've added you to my fork that is setup with Travis.

I would recommend testing out the following four scenarios:

  1. Pushing new commits directly to master should trigger a build, resulting in nothing uploaded to GitHub Releases

  2. Pushing new commits into a new branch which should trigger a build, resulting in nothing uploaded to GitHub Releases

  3. Create and push a new tag should trigger a build, resulting in new artifacts uploaded to GitHub Releases

  4. Create and push a new tag whilst on a master should trigger a build, resulting in new artifacts uploaded to GitHub Releases

  5. Create and push a new tag whilst on a new branch should trigger a build, resulting in new artifacts uploaded to GitHub Releases

Just make sure to leave this branch, issue-17 untouched 😄

0xazure commented 5 years ago

Can we use GH_TOKEN for the name?

Done, I've added it to the Travis env variables for supernova.

Agreed with the four scenarios, artifacts should only be uploaded for tagged releases on master.

seanprashad commented 5 years ago

Should note that tags don't need to be made on master as they essentially act as their own "branch".

This means that we can tag any branch, push to GitHub and it'll upload artifacts to GitHub Releases.

See an example here for v.0.0.19:

image