Skip to content

Commit

Permalink
Use goreleaser to publish GC releases
Browse files Browse the repository at this point in the history
While we work on stolon, it will be important for us to use pre-release
candidates of our own changes. This commit adds goreleaser to
automatically create these on our own forks build.
  • Loading branch information
lawrencejones committed May 9, 2019
1 parent 0ac3839 commit 2681361
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ bin/
/release/

.idea

dist/
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
################################################################################
# build
################################################################################

FROM golang:1.12 AS build
COPY . /go/src/github.com/sorintlab/stolon
WORKDIR /go/src/github.com/sorintlab/stolon

# If we're running goreleaser, then our binaries will already be copied into our
# work directory. Otherwise we should build them.
RUN set -x \
&& \
if [ ! -f stolonctl ]; then \
./build; \
mv -v bin/* ./; \
fi

################################################################################
# release
################################################################################

FROM ubuntu:18.04 AS release
RUN set -x \
&& apt-get update -y \
&& apt-get install -y curl gpg \
&& sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main\ndeb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg 11" > /etc/apt/sources.list.d/pgdg.list' \
&& curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt-get update -y \
&& apt-get install -y software-properties-common pgbouncer postgresql-client \
&& mkdir -pv /var/run/postgresql /var/log/postgresql

COPY --from=build /go/src/github.com/sorintlab/stolon/stolon* /usr/local/bin/
USER postgres
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.13.0-gc-rc1
33 changes: 33 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
version: 2

jobs:
release:
working_directory: /go/src/github.com/sorintlab/stolon
docker:
- image: golang:1.12
steps:
- checkout
- run:
name: Release
command: |
CURRENT_VERSION="v$(cat VERSION)"
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then
echo "Version ${CURRENT_VERSION} is already released"
exit 0
fi
curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v0.106.0/goreleaser_Linux_x86_64.tar.gz
tar zxf /tmp/goreleaser_Linux_x86_64.tar.gz -C /tmp
git tag "${CURRENT_VERSION}"
git push --tags
/tmp/goreleaser --rm-dist
workflows:
version: 2
build-integration:
jobs:
- release
44 changes: 44 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# View goreleaser docs for configuration settings
# https://goreleaser.com

---
project_name: stolon

release:
github:
owner: gocardless
name: stolon

builds:
- binary: stolonctl
main: cmd/stolonctl/main.go
goos: &goos
- linux
goarch: &goarch
- amd64
ldflags: &ldflags >
-X cmd.Version={{.Version}}
-X cmd.Commit={{.Commit}}
-X cmd.Date={{.Date}}
-a
-installsuffix cgo
env: &env
- CGO_ENABLED=0
- binary: stolon-keeper
main: cmd/keeper/main.go
goos: *goos
goarch: *goarch
ldflags: *ldflags
env: *env
- binary: stolon-proxy
main: cmd/proxy/main.go
goos: *goos
goarch: *goarch
ldflags: *ldflags
env: *env
- binary: stolon-sentinel
main: cmd/sentinel/main.go
goos: *goos
goarch: *goarch
ldflags: *ldflags
env: *env

0 comments on commit 2681361

Please sign in to comment.