Skip to content

Commit

Permalink
Merge pull request #15 from philips-labs/feature/make-release
Browse files Browse the repository at this point in the history
Feature/make release
  • Loading branch information
marcofranssen authored Jul 20, 2020
2 parents 72e63d0 + ba52875 commit c16408a
Show file tree
Hide file tree
Showing 8 changed files with 924 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,30 @@ jobs:
name: codecov-umbrella
yml: ./codecov.yml
fail_ci_if_error: true

release:
name: release
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.14
uses: actions/[email protected]
with:
go-version: 1.14

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Login to DockerHub Registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin

- name: Release
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bin/
dist/
.env
*.out
github-project-matching.json
72 changes: 72 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: tabia

before:
hooks:
- go mod download

env:
- CGO_ENABLED=0

builds:
- id: binary
dir: cmd/tabia
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
goarm:
- 8
ldflags:
- -s -w -X main.version={{.Version}}

archives:
- id: archive
format: tar.gz
replacements:
darwin: macOS
files:
- LICENSE*
- README*
format_overrides:
- goos: windows
format: zip

dockers:
- goos: linux
goarch: amd64
image_templates:
- "philipssoftware/{{ .ProjectName }}:{{ .Tag }}"
- "philipssoftware/{{ .ProjectName }}:v{{ .Major }}"
- "philipssoftware/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}"
- "philipssoftware/{{ .ProjectName }}:latest"
build_flag_templates:
- "--pull"
- "--label=com.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=VERSION={{.Version}}"
extra_files:
- "go.mod"
- "go.sum"
- "cmd"
- "lib"
checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:1.14-alpine as builder
RUN mkdir build
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
ARG VERSION=dev-docker
COPY . .
RUN CGO_ENABLED=0 go build -v -trimpath -ldflags "-X 'main.version=${VERSION}'" -o bin/tabia ./cmd/tabia

FROM alpine
LABEL maintainer="[email protected]"
RUN mkdir /app
WORKDIR /app
VOLUME [ "/app" ]
ENV TABIA_BITBUCKET_API=\
TABIA_BITBUCKET_USER=\
TABIA_BITBUCKET_TOKEN=\
TABIA_GITHUB_USER=\
TABIA_GITHUB_TOKEN=
COPY --from=builder build/bin/tabia .
ENTRYPOINT [ "/app/tabia" ]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ coverage-out: test-cover ## Show coverage in cli

coverage-html: test-cover ## Show coverage in browser
@go tool cover -html=coverage.out

dockerize: ## Created development docker image
docker build -t philipssoftware/tabia:dev .
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ require (
github.com/antonmedv/expr v1.8.8
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/goreleaser/goreleaser v0.140.0 // indirect
github.com/shurcooL/githubv4 v0.0.0-20200414012201-bbc966b061dd
github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
github.com/stretchr/testify v1.6.1
github.com/urfave/cli/v2 v2.2.0
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
golang.org/x/tools v0.0.0-20200702044944-0cc1aa72b347
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect
)
797 changes: 797 additions & 0 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
package main

import (
_ "github.com/goreleaser/goreleaser"
_ "golang.org/x/tools/cmd/stringer"
)

0 comments on commit c16408a

Please sign in to comment.