Skip to content
Snippets Groups Projects
Commit 2902f784 authored by Joe Beda's avatar Joe Beda Committed by bryanl
Browse files

Document using goreleaser


Signed-off-by: default avatarJoe Beda <joe.github@bedafamily.com>
parent d366249b
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
_obj
_test
_output
dist
# Architecture specific extensions/prefixes
*.[568vq]
......
project_name: ks
builds:
- main: .
binary: ks
ldflags: -X main.version={{.Version}}
goos:
- linux
- darwin
- windows
goarch:
- amd64
archive:
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- README.md
- CHANGELOG.md
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
release:
github:
owner: ksonnet
name: ksonnet
brew:
github:
owner: INVALID
name: homebrew-tap
commit_author:
name: heptibot
email: heptibot@heptio.com
homepage: "https://ksonnet.io"
description: "The ksonnet command line utility. Manage and deploy Kubernetes applications."
......@@ -106,22 +106,4 @@ To do so, run `make test` in the root of the ksonnet repo, specifying any additi
## Make a Release
To make a new release, follow these instructions:
1. Set a release tag (based on [semvar](http://semver.org/)):
```
VERSION=vX.Y.Z
```
2. Build a release binary (this will set the `ks` version to `$VERSION`):
```
make install -e VERSION=$VERSION
```
3. Add an appropriate tag. We do this via `git` (not the github UI) so that the tag is signed. This process requires you to have write access to the real `master` branch (not your local fork).
```
git fetch # update
git tag -s -m $VERSION $VERSION origin/master
git push origin tag $VERSION
```
4. *Now* create the Github release, using the existing tag created
above.
See our [release documentation](docs/release.md) for the process of creating a release.
# Releasing a new version of `ks`
We use the [goreleaser](https://goreleaser.com) project to automate building and marking releases for `ks`.
This does the following for us:
1. Builds binaries across platforms and creates release tarballs/zips.
1. [optionally] Creates a changelog based on all PRs since the last release.
1. Creates a github release, uploading the changelog and the release archives.
1. Updates homebrew formula to point to the new release.
This is super convenient! But it is a little more involved than just running a command as we lock down our homebrew tap repo.
Detailed instructions follow.
## Install and configure goreleaser
Follow the instructions on https://goreleaser.com for downloading and installing goreleaser.
In addition to getting the utility itself installed you need to make sure that you have a github token created and set in an environment variable.
Do this by going [here](https://github.com/settings/tokens/new) and ensure that the `repo` scope is selected.
Take the resultant token and set it in a `GITHUB_TOKEN` environment variable.
Multiple utilities (including `ks` itself!) will use this token so this isn't a bad thing to have set up all the time.
Make sure you don't check this token in anywhere thought!
```bash
export GITHUB_TOKEN=<long hex number>
```
## Tag a release
We use semantic versioning to tag a release.
See [semvar](http://semver.org/).
```bash
VERSION=v0.9.0
git tag -a $VERSION -m $VERSION
git push origin $VERSION
```
If you have GPG signing set up for git, you can add an `-s` above to create a signed tag.
## Create and clone fork of `ksonnet/homebrew-tap`
You are going to have to create a PR for the updated homebrew tap file.
As such, go to https://github.com/ksonnet/homebrew-tap and hit the "fork" button.
Then do the following someplace:
```
git clone git@github.com:GITHUB_USER_NAME/homebrew-tap.git ksonnet-homebrew-tap
cd ksonnet-homebrew-tap
git remote add upstream git@github.com:ksonnet/homebrew-tap.git
git fetch upstream
```
## Update your fork of `ksonnet/homebrew-tap`
If your fork isn't caught up with the upstream repo you need to do this as goreleaser will write directly to github and you want to minimize merge conflicts later.
```
cd ksonnet-homebrew-tap
git fetch upstream
git pull
git rebase upstream/master
git push
```
## Copy and update .goreleaser.yml
Back in the `ksonnet` directory
```bash
cp .goreleaser.yml $TMPDIR
```
Now edit `$TMPDIR/.goreleaser.yml` and update the brew section to point to your repo.
## Build and push release
```bash
goreleaser --config $TEMPDIR/.goreleaser.yml
```
### [optional] Custom release notes
If you want custom release notes (instead of the autogenerated ones) then create a markdown file (`$TEMPDIR/release-notes.md`) and run this instead.
```bash
goreleaser --config $TEMPDIR/.goreleaser.yml --release-notes $TEMPDIR/release-notes.md
```
At this point, if everything goes well, there should be a new release at https://github.com/ksonnet/ksonnet/releases. Check it out and make sure it looks good.
## Create PR for brew update
```
cd ksonnet-homebrew-tap
git pull
git commit --amend --reset-author --signoff --no-edit
git push origin -f
```
Now go to your fork on github and create a PR for the updated brew formula
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment