Skip to content

Commit

Permalink
Merge pull request #308 from redhatrises/automate_binary_creation
Browse files Browse the repository at this point in the history
Enable automating binary builds with goreleaser when new tag is pushed
  • Loading branch information
shawndwells committed Jun 20, 2018
2 parents 8f11f13 + 543114f commit f8d2c89
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
13 changes: 12 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- run:
name: Install Git
command: apk add --no-cache bash gcc git musl-dev curl
command: apk add --no-cache bash gcc git openssh-client musl-dev curl rpm
- checkout

- run:
Expand All @@ -23,3 +23,14 @@ jobs:
name: Send results to Codecov
shell: /bin/bash
command: bash <(curl -s https://codecov.io/bash)
- deploy:
name: goreleaser
command: |
if [[ ! -z ${CIRCLE_TAG} ]]; then
echo "TAG: ${CIRCLE_TAG}"
curl -sL https://git.io/goreleaser | bash
fi
deployment:
trigger_tag:
tag: /.*/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/compliance-masonry
/masonry
/coverage.txt
/dist
*.swp
*.out
/build
29 changes: 12 additions & 17 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,27 @@ to stick to a specific version, or need to add a new dependency.
make test
```

## Creating binaries
## Tagging a New Release

This will only be relevant for maintainers.

### One-time setup for uploading binaries

1. Install [goxc](https://github.com/laher/goxc)
1. Checkout the master branch
NOTE: Make sure that the master branch is clean and has the latest commits from GitHub.

```sh
go get github.com/laher/goxc
git checkout master
```

1. [Get a GitHub API token](https://github.com/settings/tokens/new). The token should have write access to repos.
1. Add a .goxc.local.json file with a github api key
1. Using `v.1.1.1` as an example, tag the new release using the convention in the example below:

```sh
goxc -wlc default publish-github -apikey=123456789012
git tag -m "Bump to v1.1.1" v1.1.1
```

### Compiling and uploading binaries

1. Set version number in:
* [`.goxc.json`](.goxc.json)
* As `app.Version` in [`masonry-go.go`](masonry-go.go)
1. Run the release script
1. Using `v1.1.1` as an example, push the tag back to GitHub

```sh
./release.sh
git push origin v1.1.1
```

1. CircleCI will then run through the tests. Since there is a new tag, CircleCI will also install and run
[GoReleaser](https://github.com/goreleaser/goreleaser) which will build and upload the binaries for release.

2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cp compliance-masonry_1.1.2_darwin_amd64/compliance-masonry /usr/local/bin

## Windows

1. Go to [the Github Release](https://github.com/opencontrol/compliance-masonry/releases/tag/v1.1.2).
1. Go to [the Github Release](https://github.com/opencontrol/compliance-masonry/releases/latest).
1. Download the package that corresponds to your machine and operating system.
- For 32 Bit Windows, you'll want the file ending `_windows_386.zip`
- For 64 Bit Windows, you'll want the file ending `_windows_amd64.zip`
Expand Down

0 comments on commit f8d2c89

Please sign in to comment.