Integrate ghr with CI as a Service

Sasha Gerrand edited this page Nov 3, 2016 · 4 revisions
Clone this wiki locally

You can integrate ghr with CI-as-a-Service to release your project after test passed. This page shows how to integrate ghr with them. Here, we will cover 4 services:

We assume that you want to provide latest build binaries as Pre-release to your user continuously when new commits are pushed or merged into master. To do this, we use --replace option to replace binary in every-time.

Wercker

We provide Wercker step for ghr (tcnksm/wercker-step-ghr), so you just add it on your wercker.yml file deploy section. Here, we assume you want to release all artifacts with pre-release tag and replace them every-time if it exits.

steps:
   - tcnksm/ghr:
     token: $GITHUB_TOKEN
     input: dist
     pre_release: true       # Relase as pre-release default is false
     replace: true           # Replace artifacts if it's already upladed

Here, input is directory where your artifacts you want to upload are in and it would be in ${WERCKER_OUTPUT_DIR} passed from build step. You need to set GITHUB_TOKEN from Wercker setting tabs.

We have complete sample scripts for this, see tcnksm-sample/wercker-golang.

TravisCI

Here, we assume your artifacts you want to release on Github are generated in dist directory in other step and release them with pre-release tag and replace every-time if it exits. You just add below in your .travis.yml file:

...
before_install:
  - go get github.com/tcnksm/ghr
...
after_success:
  - ghr --username tcnksm-sample --token $GITHUB_TOKEN --replace --prerelease --debug pre-release dist/

You need to set GITHUB_TOKEN in environmental variables on TravisCI's settings tab.

We have complete sample scripts for this, see tcnksm-sample/travis-golang.

Drone.io

Here, we assume your artifacts you want to release on Github are generated in dist directory in other step and release them with pre-release tag and replace every-time if it exits. You just paste below code on commands in drone.io from settings tab and set GITHUB_TOKEN on Environmental Variables:

go get github.com/tcnksm/ghr
ghr --username tcnksm-sample \
       --token $GITHUB_TOKEN \
       --replace \
       --prerelease \
       --debug \
       pre-release dist/

We have complete sample scripts for this, see tcnksm-sample/drone-golang.

CircleCI

Here, we assume your artifacts you want to release on Github are generated in dist directory in other step and release them with pre-release tag and replace every-time if it exits. You just add below in your circle.yml file:

...
dependencies:
  pre:
    - go get github.com/tcnksm/ghr
...
deployment:
  release:
    branch: master
    commands:
      - ghr --username tcnksm-sample --token $GITHUB_TOKEN --replace --prerelease --debug pre-release dist/

You need to set GITHUB_TOKEN in environmental variables on CircleCI's settings tab.