Skip to content

Commit 70ff3f7

Browse files
chore: add goreleaser (#44)
1 parent a0c1a23 commit 70ff3f7

File tree

5 files changed

+134
-13
lines changed

5 files changed

+134
-13
lines changed

.github/workflows/build_dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ jobs:
1818
uses: docker/build-push-action@v2
1919
with:
2020
push: true
21+
file: "./Dockerfile.dev"
2122
tags: |
2223
odpf/columbus:dev

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up Go
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: '^1.16'
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
- name: Login to DockerHub
22+
uses: docker/login-action@v1
23+
with:
24+
registry: docker.io
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
- name: Run GoReleaser
28+
uses: goreleaser/[email protected]
29+
with:
30+
distribution: goreleaser
31+
version: latest
32+
args: --rm-dist
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_TOKEN }}

.goreleaser.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
project_name: columbus
2+
3+
release:
4+
prerelease: auto
5+
draft: true
6+
7+
before:
8+
hooks:
9+
- go mod tidy
10+
- make clean
11+
12+
builds:
13+
- main: ./main.go
14+
binary: columbus
15+
flags: [-a]
16+
ldflags:
17+
- -X github.com/odpf/columbus/cmd.Version={{.Tag}}
18+
- -X github.com/odpf/columbus/cmd.BuildCommit={{.FullCommit}}
19+
- -X github.com/odpf/columbus/cmd.BuildDate={{.Date}}
20+
goos: [linux, darwin, windows]
21+
goarch: [amd64, 386, arm, arm64] # skip goarch 386 and arm due to conflicts with "github.com/blastrain/vitess-sqlparser" library
22+
env:
23+
- CGO_ENABLED=0
24+
25+
archives:
26+
- replacements:
27+
darwin: macos
28+
linux: linux
29+
windows: windows
30+
386: i386
31+
amd64: x86_64
32+
format_overrides:
33+
- goos: windows
34+
format: zip
35+
36+
checksum:
37+
name_template: 'checksums.txt'
38+
39+
snapshot:
40+
name_template: "{{ .Tag }}-next"
41+
42+
changelog:
43+
sort: asc
44+
filters:
45+
exclude:
46+
- '^docs:'
47+
- '^test:'
48+
- '^build:'
49+
50+
dockers:
51+
-
52+
goos: linux
53+
goarch: amd64
54+
ids:
55+
- linux
56+
dockerfile: Dockerfile
57+
image_templates:
58+
- 'docker.io/odpf/{{.ProjectName}}:latest'
59+
- 'docker.io/odpf/{{.ProjectName}}:{{ .Version }}'
60+
- 'docker.io/odpf/{{.ProjectName}}:{{ .Version }}-amd64'
61+
62+
brews:
63+
- name: columbus
64+
homepage: "https://github.com/odpf/columbus"
65+
description: "Metadata Discovery and Lineage Service"
66+
tap:
67+
owner: odpf
68+
name: homebrew-taps
69+
license: "Apache 2.0"
70+
folder: Formula
71+
72+
dependencies:
73+
- name: git
74+
install: |-
75+
bin.install "columbus"
76+
commit_author:
77+
name: Ravi Suhag
78+
79+

Dockerfile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
FROM golang:1.16-stretch as base
2-
WORKDIR /build/
3-
COPY . .
4-
RUN ["make"]
5-
61
FROM alpine:latest
7-
WORKDIR /opt/columbus
8-
COPY --from=base /build/columbus /opt/columbus/bin/columbus
9-
RUN ["apk", "update"]
10-
EXPOSE 8080
112

12-
# glibc compatibility library, since go binaries
13-
# don't work well with musl libc that alpine uses
14-
RUN ["apk", "add", "libc6-compat"]
15-
ENTRYPOINT ["/opt/columbus/bin/columbus"]
3+
COPY columbus /usr/bin/columbus
4+
RUN apk update
5+
RUN apk add ca-certificates
6+
7+
CMD ["columbus"]

Dockerfile.dev

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.16-stretch as base
2+
WORKDIR /build/
3+
COPY . .
4+
RUN ["make"]
5+
6+
FROM alpine:latest
7+
WORKDIR /opt/columbus
8+
COPY --from=base /build/columbus /opt/columbus/bin/columbus
9+
RUN ["apk", "update"]
10+
EXPOSE 8080
11+
12+
# glibc compatibility library, since go binaries
13+
# don't work well with musl libc that alpine uses
14+
RUN ["apk", "add", "libc6-compat"]
15+
ENTRYPOINT ["/opt/columbus/bin/columbus"]

0 commit comments

Comments
 (0)