Generates badges for Travis build histories. For example, the little red and/or green bar chart above this text. :)
- a public Github repo
- Travis CI set up with your Github repo
- Travis command-line tool
gem install travis
(Ruby is a prereq, obviously)
(If the two types of tokens are confusing, read Travis's blog post about them.)
Say your Github repo is at https://github.com/MyUsername/my-repo
.
-
Generate a Github personal access token:
- go to https://github.com/settings/tokens
- click "Generate new token" button with "public_repo" permissions
- note the token — you will only get to see it once!
-
Generate a Travis token from your Github token:
travis login --github-token <personal-access-token>
travis token
- note the token — you will only get to see it once!
Say your Travis build is at https://travis-ci.org/MyUsername/my-repo
.
-
Go to your Travis build's settings at
https://travis-ci.org/MyUsername/my-repo/settings
. -
Scroll down to the "Environment Variables" section.
-
Add a new
TRAVIS_ACCESS_TOKEN
variable, with the Travis token you generated at the end of the authentication instructions above.
Set the following environment variables:
TRAVIS_ACCESS_TOKEN
(obtained via command-linetravis login && travis token
)SCP_PASSWORD
Create a config.yml
file:
travis:
owner: MyGithubUsername
upload:
host: my-image-host-server.example.com
dir: images/public/travis-build-badges
username: MyScpUsername
Then run the script to generate images for all your active builds:
ruby travis-build-history-badges.rb
You can restrict which builds to generate images for by specifying a whitelist of repo names:
travis:
owner: MyGithubUsername
repos:
- foo
- bar
TRAVIS_ACCESS_TOKEN
SCP_USERNAME
SCP_PASSWORD
SCP_HOST
SCP_DIR