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: Automatically publish artifacts to GitHub #18

Merged
merged 2 commits into from
Dec 3, 2018
Merged

feat: Automatically publish artifacts to GitHub #18

merged 2 commits into from
Dec 3, 2018

Conversation

seanprashad
Copy link
Contributor

@seanprashad seanprashad commented Nov 4, 2018

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
Copy link
Contributor Author

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

@seanprashad
Copy link
Contributor Author

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

Copy link
Owner

@0xazure 0xazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @seanprashad really exited to get this pipeline integrated into the project!

You mention that you'd be looking for me to generate the API token to enable this integration; how should we combine your work with that piece of data you need from me?

Really happy to see the sha1sum calculation, verifying download integrity is useful especially since we're moving these files between a few different systems.

How does provider: releases interact with the build matrix we've already got implemented? We're building on linux/windows x stable/beta/nightly (6 separate build results), how does it differentiate the build environment configurations and make sure the files are all uniquely named?

Ideally I'd like to see something like supernova-{major.minor.patch}-{platform}-{arch} on the Releases page, possibly as a compressed/archived file that contains the compiled artifact, the license(s) and maybe some documentation/README. I'm looking at https://github.com/rustwasm/wasm-pack/releases for inspiration on how we could organize the artifacts.

.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@seanprashad seanprashad changed the title feat: Automatically publish artifacts to GitHub [WIP] feat: Automatically publish artifacts to GitHub Nov 9, 2018
@seanprashad
Copy link
Contributor Author

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

@0xazure
Copy link
Owner

0xazure commented Nov 17, 2018

No worries! Thanks for the update.

@0xazure
Copy link
Owner

0xazure commented Nov 23, 2018

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

.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@seanprashad seanprashad changed the title [WIP] feat: Automatically publish artifacts to GitHub feat: Automatically publish artifacts to GitHub Nov 25, 2018
@0xazure
Copy link
Owner

0xazure commented Nov 25, 2018

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
Copy link
Contributor Author

seanprashad commented Nov 25, 2018

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
Copy link
Contributor Author

seanprashad commented Nov 25, 2018

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

image

@seanprashad
Copy link
Contributor Author

seanprashad commented Nov 28, 2018

@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
Copy link
Owner

0xazure commented Nov 28, 2018

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.

.travis.yml Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@seanprashad
Copy link
Contributor Author

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

Travis will now publish a tarball containing the README, LICENSE-MIT,
LICENSE-APACHE and the executable for Supernova. This process is done
only for the Linux and Windows stable builds upon pushing a new tag.

In addition, we'll also provide a SHA1 hash for peace of mind.

Fixes #17
.travis.yml Outdated
skip_cleanup: true
on:
branch: master
repo: SeanPrashad/supernova
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
repo: SeanPrashad/supernova
repo: 0xazure/supernova

I think this slipped through during testing, but I know it was complicated flipping between projects and branches.

Copy link
Owner

@0xazure 0xazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @seanprashad awesome job on this! I know how much testing and troubleshooting you had to go through on Travis to get this working, so I really appreciate all the work you've put in.

It's super exciting to get automated build artifacts added to GitHub releases, because this will let us distribute precompiled source binaries to many different platforms in a lot of different packaging methods.

Thanks again! 🎉

@0xazure 0xazure merged commit 66f5bc5 into 0xazure:master Dec 3, 2018
@seanprashad seanprashad deleted the issue-17 branch December 3, 2018 22:36
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.

None yet

2 participants