Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Resolve goreleaser issues #1445

Merged
merged 8 commits into from
May 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ jobs:
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- setup_remote_docker
- run:
command: |
./.circleci/release_name.bash
echo 'export DOCKER_SHORT_TAG=$CIRCLE_SHA1' >> $BASH_ENV
source $BASH_ENV
- run: GO111MODULE=off go get github.com/mattn/goveralls github.com/ory/go-acc
- restore_cache:
keys:
Expand All @@ -58,6 +64,7 @@ jobs:
# Running race conditions requires parallel tests, otherwise it's worthless (which is the case)
# - run: go test -race -short $(go list ./... | grep -v cmd)
- 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

test-e2e-memory:
docker:
Expand Down Expand Up @@ -388,7 +395,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: curl -sL https://git.io/goreleaser | bash

workflows:
Expand Down
24 changes: 13 additions & 11 deletions .circleci/release_name.bash
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

release=$(curl -s "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/releases")
tag=$(echo ${release} | jq -r ".[0].tag_name")
tag_name=$(echo ${release} | jq -r ".[0].name")

if [[ -n "$tag_name" ]]; then
echo "export RELEASE_NAME=$tag_name" >> $BASH_ENV
else
echo "export RELEASE_NAME=$tag" >> $BASH_ENV
fi
#!/bin/bash

release=$(curl -s "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/releases")
tag=$(echo ${release} | jq -r ".[0].tag_name")
tag_name=$(echo ${release} | jq -r ".[0].name")

if [[ -n "$tag_name" ]]; then
echo "export RELEASE_NAME=$tag_name" >> $BASH_ENV
elif [[ -n "$tag" ]]; then
echo "export RELEASE_NAME=$tag" >> $BASH_ENV
else
echo "export RELEASE_NAME=$CIRCLE_SHA1" >> $BASH_ENV
fi
5 changes: 3 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ env:
before:
hooks:
- go mod download
- cp ./.releaser/LICENSE.txt ./LICENSE.txt

builds:
-
flags:
- -a
ldflags:
- -s -w -X github.com/ory/hydra/cmd.Version={{.Tag}} -X github.com/ory/hydra/cmd.Commit={{.FullCommit}} -X github.com/ory/hydra/cmd.Date={{.Date}}
- -s -w -X github.com/ory/hydra/cmd.Version={{.Env.RELEASE_NAME}} -X github.com/ory/hydra/cmd.Commit={{.FullCommit}} -X github.com/ory/hydra/cmd.Date={{.Date}}
binary: hydra
env:
- CGO_ENABLED=0
Expand All @@ -33,7 +34,7 @@ builds:
- windows
- darwin

archive:
archives:
-
replacements:
darwin: macOS
Expand Down