diff --git a/.circleci/config.yml b/.circleci/config.yml index d5486b01a..68ecae629 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,16 +70,17 @@ jobs: release: docker: - image: circleci/golang:1.12 + environment: + - GO111MODULE=on working_directory: /go/src/github.com/ory/oathkeeper steps: + - checkout - run: - name: Enable go1.12 modules command: | - echo 'export GO111MODULE=on' >> $BASH_ENV echo 'export DOCKER_FULL_TAG=$(echo $CIRCLE_TAG | tr '+' '_')' >> $BASH_ENV echo 'export DOCKER_SHORT_TAG=$(echo $CIRCLE_TAG | cut -d '+' -f1)' >> $BASH_ENV + ./.circleci/release_name.bash source $BASH_ENV - - checkout - setup_remote_docker - run: docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" - run: cp ./.releaser/LICENSE.txt ./LICENSE.txt diff --git a/.circleci/release_name.bash b/.circleci/release_name.bash new file mode 100755 index 000000000..1d0961df9 --- /dev/null +++ b/.circleci/release_name.bash @@ -0,0 +1,11 @@ +#!/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 diff --git a/.goreleaser.yml b/.goreleaser.yml index ad12854c9..3330c80ab 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -4,10 +4,12 @@ project_name: keto env: - GO111MODULE=on + before: hooks: - go mod download - packr + builds: - flags: @@ -31,22 +33,27 @@ builds: - linux - windows - darwin + archive: - replacements: - darwin: macOS - linux: Linux - windows: Windows - 386: 32-bit - amd64: 64-bit - format_overrides: - - goos: windows - format: zip - files: - - LICENSE.txt + - + replacements: + darwin: macOS + linux: Linux + windows: Windows + 386: 32-bit + amd64: 64-bit + format_overrides: + - goos: windows + format: zip + files: + - LICENSE.txt + snapshot: name_template: "{{ .Tag }}-next" + changelog: sort: asc + brew: github: owner: ory @@ -70,8 +77,11 @@ dockers: - "oryd/keto:v{{ .Major }}" - "oryd/keto:v{{ .Major }}.{{ .Minor }}" - "oryd/keto:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}" -# - "oryd/keto:{{ .Env.DOCKER_FULL_TAG }}" - "oryd/keto:{{ .Env.DOCKER_SHORT_TAG }}" - "oryd/keto:latest" extra_files: - - .releaser/LICENSE.txt \ No newline at end of file + - .releaser/LICENSE.txt + +release: + prerelease: auto + name_template: "{{.Env.RELEASE_NAME}}"