From 20a67087a67d9317f9fc6dfae51a0f7310869452 Mon Sep 17 00:00:00 2001 From: Antonio Navarro Perez Date: Fri, 6 Oct 2023 12:51:20 +0200 Subject: [PATCH] feat: add go-releaser support Signed-off-by: Antonio Navarro Perez --- .github/workflows/release.yaml | 29 ++++++++++++++++++++++++++ .gitignore | 3 ++- .goreleaser.yaml | 38 ++++++++++++++++++++++++++++++++++ Dockerfile.release | 5 +++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml create mode 100644 Dockerfile.release diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..58eec1a --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index e8c0fa6..88ca45b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ build/* # Configuration files -*.jsonl \ No newline at end of file +*.jsonl +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..b134959 --- /dev/null +++ b/.goreleaser.yaml @@ -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:" diff --git a/Dockerfile.release b/Dockerfile.release new file mode 100644 index 0000000..7db08b3 --- /dev/null +++ b/Dockerfile.release @@ -0,0 +1,5 @@ +FROM scratch + +COPY /tx-archive /tx-archive + +ENTRYPOINT ["/tx-archive"]