Skip to content

Commit

Permalink
cicd: Tweak ghr config for GitHub releases
Browse files Browse the repository at this point in the history
Get the ghr config working locally. Related to #5.

Added:

- Include sha256 checksum file for binaries
- `make release-draft`: Publish a draft release to GitHub

Changed:

- Built binaries now include the version string
  • Loading branch information
Tim O'Guin committed Apr 17, 2020
1 parent d2c2caa commit 903b5c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
22 changes: 3 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

<!--
Any notes about merges to master that haven't been added to a Git tag should go
here. When it's time to cut a new release, create a header for the new version
below and move the content of this section down to the new version.
### Added
If you add any new code or functionality, document your changes here.
### Changed
If you change any existing code or functionality, document your changes here.
### Removed
If you remove any existing code or functionality, document your changes here.
-->

Upcoming release

### Added
Expand All @@ -35,11 +16,14 @@ Upcoming release
- `make debug`: Display generated vars used in the Makefile
- Commit vendored modules to the repo
- `.go-version` file set to 1.14.0
- Include sha256 checksum file for binaries
- `make release-draft`: Publish a draft release to GitHub

### Changed

- `make build_all`: Use `go mod tidy` and `go mod vendor`
- Determine version from Git describe output
- Built binaries now include the version string

### Removed

Expand Down
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,25 @@ build: ## Build binary for the current platform
@echo "Building binary for your current environment"
go build ${LDFLAGS}

build_all: ## Build multi-platform binaries
build-all: ## Build multi-platform binaries
@echo "Tidying and vendoring go modules"
go mod tidy
go mod vendor
@echo "Building multi-platform binaries using gox"
gox ${LDFLAGS} -output "dist/${BIN_NAME}_{{.OS}}_{{.Arch}}"
gox ${LDFLAGS} -output "dist/${BIN_NAME}-${VERSION}-{{.OS}}-{{.Arch}}"

release: ## Publish release binaries to GitHub
release: gen-checksums ## Publish release binaries to GitHub
@echo "Publishing release binaries to GitHub"
@if [ "$$(git diff --stat)" ]; then echo "Git tree is dirty! Aborting"; exit 1; fi
ghr -t $$GITHUB_TOKEN -u ${GH_OWNER} -r ${GH_REPO} --replace `git describe --tags` dist/
ghr -soft ${VERSION} dist/

release-draft: gen-checksums ## Publish draft release binaries to GitHub
@echo "Publishing draft release binaries to GitHub"
ghr -replace -draft -name ${VERSION} ${VERSION} dist/

gen-checksums: ## Generate sha256 checksum file
@echo "Generating sha256 sums for binaries"
sha256sum dist/* > dist/${BIN_NAME}-${VERSION}.sha256sums

tools: ## Install build and release tools
@echo "Installing build and release tools"
Expand Down

0 comments on commit 903b5c4

Please sign in to comment.