Go-App Packaging Template for Debian, RedHat, Homebrew and Docker.
The bits are here, and the readme/howto is coming soon.
In a nutshell (and it's a bit more than a nutshell):
- Use this template. Name the repo the same as your go app.
- Edit settings.sh. Most of the config is done here.
- If you're not sure about something, don't change it.
mv .travis.yml travis.yml ; touch .travis.yml ; travis setup releases
- Accept the defaults. All you need is the
secure
key.
- Accept the defaults. All you need is the
- Enable Travis-CI builds for your new repo. Just check the box.
- Copy the
secure
api key from.travis.yml
totravis.yml
, then put it back:- Get the indentation right.
mv travis.yml .travis.yml
- With no other changes Travis-CI should build
hello-world
from your repo.
If you want to push homebrew formula, you'll need to make another repo for your homebrew tap.
Mine is named golift/homebrew-mugs
. The mugs
part can be any word you want, formula
is normal, I'm just weird.
- Add an SSH key to your homebrew repo.
- Run this:
ssh-keygen -t rsa -b 4096 -C "<your_email>" -f github_deploy_key -N ''
- Make a tar file with this key.
tar -cf .secret_files.tar github_deploy_key
and encrypt it: travis encrypt-file .secret_files.tar
andgit add .secret_files.tar.enc
- Select
Add deploy key
and upload the contents ofgithub_deploy_key.pub
here:https://github.com/<username>/<repository>/settings/keys
- Update
.travis.yml
with the$encrypted_XXXXXXXXXXXX_key
and$encrypted_XXXXXXXXXXXX_iv
values printed bytravis encrypt-file .secret-files.tar
. - Using a tar file in case you want to add more secure files later. Travis only supports one encrypted file per repo.
- The included .travis.yml file will extract the tar file and use the github_deploy_key file automatically.
- Run this:
If you want to support Docker Builds, create a new Docker Repo, and link it to your new Github Repo. Use this example to setup your build in Docker Cloud. Pretty simple, just add the Tag Auto Build and ENV variables.
Supports uploading to packagecloud! This makes providing your packages to Linux users extremely easy.
To make this work, go to packagecloud.io and copy your API key. Head to terminal and run:
travis encrypt PACKAGECLOUD-API-KEY
That prints out a really long secure
line.
Copy and paste that into .travis.yml twice, once for each package type (rpm
and deb
).
- Add your Go code, or start hacking on hello-world; it contains quite a bit of boilerplate to get you started.
- Update the MANUAL.md file.
- Refine settings.sh (it doesn't take much). Make some wiki pages, like
Docker
. - If your app runs as a service update the package scripts for linux.
- Fix the
REPO
variable in the install.sh script. - Clean up .gitignore.
Bitly API integration is included to allow shortening a download link in the homebrew formula. Using bitly gives you download statistics for brew tap installs. There is no other way to obtain this information. A wiki will later be added explaining how to add your bitly API Token.
These repos use this template.