Skip to content

Commit

Permalink
feat: add goreleaser for build and release steps (#20)
Browse files Browse the repository at this point in the history
fixes #8
  • Loading branch information
mr-karan authored Sep 14, 2023
1 parent 6cbcba0 commit 80c59c1
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: goreleaser

on:
push:
tags:
- "v*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --parallelism 1 --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config.toml
# build
pb
bin/
dist/

# OS Files
.DS_Store
50 changes: 50 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
env:
- GO111MODULE=on
- CGO_ENABLED=0

builds:
- binary: pb
id: pb
main: ./main.go
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
flags:
- -trimpath
- -tags=kqueue
ldflags:
- -s -w -X main.Version={{ .Version }} -X main.Commit={{ .ShortCommit }}

archives:
- format: tar.gz
rlcp: true
files:
- README.md
- LICENSE

dockers:
- id: pb
goos: linux
goarch: amd64
ids:
- pb
image_templates:
- "parseablehq/pb:{{ .Tag }}"
- "parseablehq/pb:latest"
skip_push: false
dockerfile: Dockerfile
use: docker
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title=Parseable"
- "--label=maintainer=Parseable Team <[email protected]>"
- "--label=org.opencontainers.image.vendor=Cloudnatively Pvt Ltd"
- "--label=org.opencontainers.image.licenses=AGPL-3.0"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/amd64"
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ubuntu:22.04
RUN apt-get -y update && apt install -y ca-certificates
WORKDIR /app
COPY pb .
ENTRYPOINT [ "./pb" ]

0 comments on commit 80c59c1

Please sign in to comment.