Skip to content

Commit

Permalink
feat: adds goreleaser and release job
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszmajsak committed Dec 11, 2019
1 parent 1dc8992 commit bf5436c
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 6 deletions.
47 changes: 41 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
defaults:
docker:
- image: &golang-img circleci/golang:1.13.4

version: 2.1

jobs:
## Regular build running unit tests and linters
build:
working_directory: /go/src/github.com/bartoszmajsak/github-changelog-generator
docker:
- image: circleci/golang:1.13.4
- image: *golang-img
steps:
- checkout
- restore_cache:
Expand All @@ -19,8 +23,39 @@ jobs:
paths:
- ./vendor

workflows:
version: 2.1
circleci_build:
jobs:
- build
release:
working_directory: /go/src/github.com/bartoszmajsak/github-changelog-generator
docker:
- image: *golang-img
steps:
- checkout
- run:
name: "Release it!"
command: |
curl -sL https://git.io/goreleaser | bash -s -- release --rm-dist
workflows:
version: 2.1
circleci_build:
jobs:
- build
circleci_e2e_tests:
jobs:
- e2e_tests_local
- e2e_tests_remote
circleci_release:
jobs:
- build:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- release:
requires:
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
30 changes: 30 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
before:
hooks:
- make deps
builds:
- env:
- CGO_ENABLED=0
## Overlaps with what is defined in Makefile - we should find a away of having it defined only once
- PACKAGE_NAME=github.com/bartoszmajsak/github-changelog-generator
- RELEASE=true
main: ./cmd/
binary: ghc
goos:
- linux
- darwin
goarch:
- 386
- amd64
ldflags:
- -s -w -X {{.Env.PACKAGE_NAME}}/version.Release={{.Env.RELEASE}} -X {{.Env.PACKAGE_NAME}}/version.Version=v{{.Version}} -X {{.Env.PACKAGE_NAME}}/version.Commit={{.ShortCommit}} -X {{.Env.PACKAGE_NAME}}/version.BuildTime={{.Date}}
archives:
- name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"

0 comments on commit bf5436c

Please sign in to comment.