Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1077 from yeya24/add-circleci-cache
Browse files Browse the repository at this point in the history
add goreleaser in circleci
  • Loading branch information
starnop authored Nov 16, 2019
2 parents 7665ff0 + 604d7ff commit 9017881
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,65 @@ jobs:
make integration-test
- go/save-cache

release:
docker:
- image: circleci/golang:1.12.10
working_directory: /go/src/github.com/dragonflyoss/Dragonfly
steps:
- checkout
- go/load-cache
# TODO(yeya24): consider a better way to inject build date
- run:
name: inject build date
command: echo 'export DATE=$(date "+%Y%m%d-%H:%M:%S")' >> $BASH_ENV
- run: curl -sL https://git.io/goreleaser | bash
- go/save-cache

# TODO(yeya24): Consider changing to use goreleaser to publish images later
publish-images:
docker:
- image: circleci/golang:1.12.10
working_directory: /go/src/github.com/dragonflyoss/Dragonfly
steps:
- checkout
- setup_remote_docker
- run: echo 'export DF_VERSION=${CIRCLE_TAG:1}' >> $BASH_ENV
- go/load-cache
- run: make docker-build
- run:
name: push images
command: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker tag dfclient:$DF_VERSION dragonflyoss/dfclient:$DF_VERSION
docker tag supernode:$DF_VERSION dragonflyoss/supernode:$DF_VERSION
docker tag dfclient:$DF_VERSION dragonflyoss/dfclient:latest
docker tag supernode:$DF_VERSION dragonflyoss/supernode:latest
docker push dragonflyoss/dfclient:$DF_VERSION
docker push dragonflyoss/supernode:$DF_VERSION
docker push dragonflyoss/dfclient:latest
docker push dragonflyoss/supernode:latest
- go/save-cache

workflows:
version: 2
ci:
jobs:
- linters-check
- unit-test-golang
- api-integration-test

release:
jobs:
- release:
# Only run this job on git tag pushes
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
- publish-images:
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
58 changes: 58 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
env:
- GO111MODULE=on
- CGO_ENABLED=0
before:
hooks:
- go mod tidy
builds:
- binary: supernode
id: "supernode"
main: cmd/supernode/main.go
goarch:
- amd64
goos:
- linux
- darwin
ldflags:
- -s -w -X github.com/dragonflyoss/Dragonfly/version.version={{.Version}}
- -X github.com/dragonflyoss/Dragonfly/version.revision={{.ShortCommit}}
- -X github.com/dragonflyoss/Dragonfly/version.buildDate={{.Env.DATE}}

- binary: dfget
id: "dfget"
main: cmd/dfget/main.go
goarch:
- amd64
goos:
- linux
- darwin
ldflags:
- -s -w -X github.com/dragonflyoss/Dragonfly/version.version={{.Version}}
- -X github.com/dragonflyoss/Dragonfly/version.revision={{.ShortCommit}}
- -X github.com/dragonflyoss/Dragonfly/version.buildDate={{.Env.DATE}}

- binary: dfdaemon
id: "dfdaemon"
main: cmd/dfdaemon/main.go
goarch:
- amd64
goos:
- linux
- darwin
ldflags:
- -s -w -X github.com/dragonflyoss/Dragonfly/version.version={{.Version}}
- -X github.com/dragonflyoss/Dragonfly/version.revision={{.ShortCommit}}
- -X github.com/dragonflyoss/Dragonfly/version.buildDate={{.Env.DATE}}

# archives in the tarball
archives:
- wrap_in_directory: true
# additional files
files:
- LICENSE
- README.md

checksum:
name_template: 'checksums.txt'

0 comments on commit 9017881

Please sign in to comment.