From 5b3ec7bbd7c287c352886245cf08df2055a8d108 Mon Sep 17 00:00:00 2001 From: Billy He Date: Tue, 11 Jun 2019 00:19:40 -0700 Subject: [PATCH] Update CircleCI and goreleaser config --- .circleci/config.yml | 43 +++++++++++++++++++++++++++++-------------- .goreleaser.yml | 15 ++++++++++++--- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d1d55b3..29cad4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,7 +39,7 @@ jobs: name: Running test command: go test -v ./... - release-snapshot: + release-tag: working_directory: ~/docker-builder docker: - image: circleci/golang:1.12 @@ -49,9 +49,9 @@ jobs: key: docker-builder-{{ .Branch }}-{{ .Revision }} - run: name: Running goreleaser - command: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist --snapshot + command: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist - release-tag: + release-snapshot: working_directory: ~/docker-builder docker: - image: circleci/golang:1.12 @@ -61,7 +61,22 @@ jobs: key: docker-builder-{{ .Branch }}-{{ .Revision }} - run: name: Running goreleaser - command: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist + command: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist --snapshot + - run: + name: Preparing artifacts directory + command: | + rm -fr ./artifacts + mkdir ./artifacts + cp -r ./dist/*.zip ./artifacts/ + cp ./dist/checksums.txt ./artifacts/ + - run: + name: Install ghr + command: go get github.com/tcnksm/ghr + - run: + name: Publish snapshot to GitHub + command: | + VERSION="snapshot-${CIRCLE_BRANCH}-$(date +%Y%m%d-%H%M%S)" + ghr -delete -prerelease -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./artifacts/ workflows: version: 2 @@ -70,26 +85,19 @@ workflows: - setup: filters: tags: - only: /.*/ # Required since some jobs that depends on this job has tag filters + ignore: /snapshot.*/ - lint: requires: - setup filters: tags: - only: /.*/ # Required since some jobs that depends on this job has tag filters + ignore: /snapshot.*/ - test: requires: - setup filters: tags: - only: /.*/ # Required since some jobs that depends on this job has tag filters - - release-snapshot: - requires: - - lint - - test - filters: - branches: - only: master + ignore: /snapshot.*/ - release-tag: requires: - lint @@ -101,3 +109,10 @@ workflows: tags: # ... and only run "release-tag" workflow/job for tags that resemble version numbers. only: /v[0-9]+(\.[0-9]+)*(-.*)*/ + - release-snapshot: + requires: + - lint + - test + filters: + branches: + only: master diff --git a/.goreleaser.yml b/.goreleaser.yml index ce1d3bb..762bce1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -3,13 +3,22 @@ builds: binary: docker-builder env: - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows + goarch: + - 386 + - amd64 archives: - - replacements: - darwin: Darwin + - + format: zip + replacements: + darwin: macOS linux: Linux windows: Windows - 386: i386 + 386: x86 amd64: x86_64 checksum: