diff --git a/.circleci/config.yml b/.circleci/config.yml index 68ecae629..50d47547f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,13 +47,14 @@ jobs: - MYSQL_ROOT_PASSWORD=test working_directory: /go/src/github.com/ory/keto steps: + - checkout + - setup_remote_docker - run: - name: Enable go1.11 modules command: | echo 'export GO111MODULE=on' >> $BASH_ENV + ./.circleci/release_name.bash + echo 'export DOCKER_SHORT_TAG=$CIRCLE_SHA1' >> $BASH_ENV source $BASH_ENV - - checkout - # Installation - run: go mod verify - run: go install github.com/ory/keto @@ -66,6 +67,7 @@ jobs: # Submit coverage details - run: test -z "$CIRCLE_PR_NUMBER" && goveralls -service=circle-ci -coverprofile=coverage.txt -repotoken=$COVERALLS_REPO_TOKEN || echo "forks are not allowed to push to coveralls" + - run: curl -sL https://git.io/goreleaser | bash -s -- --snapshot --skip-publish --rm-dist release: docker: @@ -83,8 +85,6 @@ jobs: source $BASH_ENV - setup_remote_docker - run: docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" - - run: cp ./.releaser/LICENSE.txt ./LICENSE.txt - - run: go install github.com/gobuffalo/packr/packr - run: curl -sL https://git.io/goreleaser | bash release-docs: diff --git a/.circleci/release_name.bash b/.circleci/release_name.bash index 1d0961df9..20c106fc6 100755 --- a/.circleci/release_name.bash +++ b/.circleci/release_name.bash @@ -6,6 +6,8 @@ tag_name=$(echo ${release} | jq -r ".[0].name") if [[ -n "$tag_name" ]]; then echo "export RELEASE_NAME=$tag_name" >> $BASH_ENV -else +elif [[ -n "$tag" ]]; then echo "export RELEASE_NAME=$tag" >> $BASH_ENV +else + echo "export RELEASE_NAME=$CIRCLE_SHA1" >> $BASH_ENV fi diff --git a/.goreleaser.yml b/.goreleaser.yml index 3330c80ab..bcce10243 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,6 +8,8 @@ env: before: hooks: - go mod download + - cp ./.releaser/LICENSE.txt ./LICENSE.txt + - go install github.com/gobuffalo/packr/packr - packr builds: @@ -15,7 +17,7 @@ builds: flags: - -a ldflags: - - -s -w -X github.com/ory/keto/cmd.Version={{.Tag}} -X github.com/ory/keto/cmd.Commit={{.FullCommit}} -X github.com/ory/keto/cmd.Date={{.Date}} + - -s -w -X github.com/ory/keto/cmd.Version={{.Env.RELEASE_NAME}} -X github.com/ory/keto/cmd.Commit={{.FullCommit}} -X github.com/ory/keto/cmd.Date={{.Date}} binary: keto env: - CGO_ENABLED=0 @@ -34,7 +36,7 @@ builds: - windows - darwin -archive: +archives: - replacements: darwin: macOS