Skip to content

Commit

Permalink
Update CircleCI and goreleaser config
Browse files Browse the repository at this point in the history
  • Loading branch information
Billy He committed Jun 11, 2019
1 parent 0ae58cc commit 5b3ec7b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 17 deletions.
43 changes: 29 additions & 14 deletions .circleci/config.yml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
15 changes: 12 additions & 3 deletions .goreleaser.yml
Expand Up @@ -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:
Expand Down

0 comments on commit 5b3ec7b

Please sign in to comment.