Skip to content

Commit

Permalink
feat: add go-releaser support
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
  • Loading branch information
ajnavarro committed Oct 6, 2023
1 parent 28d309d commit 95fedc8
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- "*"

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: stable
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
build/*

# Configuration files
*.jsonl
*.jsonl
dist/
38 changes: 38 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
main: ./cmd

dockers:
- dockerfile: Dockerfile.release
image_templates:
- "gnolang/tx-archive:latest"
- "gnolang/tx-archive:{{ .Tag }}"
- "gnolang/tx-archive:v{{ .Major }}"
- "gnolang/tx-archive:v{{ .Major }}.{{ .Minor }}"
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
5 changes: 5 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch

COPY /tx-archive /tx-archive

ENTRYPOINT ["/tx-archive"]
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#-include .env

BIN_OUTPUT ?= build/archive

all: build

.PHONY: build
build:
@echo "Building archive binary"
go build -o build/archive ./cmd
go build -o $(BIN_OUTPUT) ./cmd

.PHONY: lint
lint:
Expand Down

0 comments on commit 95fedc8

Please sign in to comment.