From 9fa2f39486f8ee75b45949e09f322dbb88d3b992 Mon Sep 17 00:00:00 2001 From: "Viktor A. Rozenko Voitenko" Date: Fri, 27 Jan 2023 12:09:49 +0300 Subject: [PATCH] infra(release): update `goreleaser` configuration --- .github/workflows/release.yaml | 5 +--- .gitignore | 2 ++ .goreleaser.yaml | 47 ++++++++++++++++++++++++++++------ main.go | 4 +-- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0b543b8..a0d76bf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,8 +2,6 @@ name: release on: push: - branches: - - main tags: - "*" @@ -26,10 +24,9 @@ jobs: go-version: '^1.19' check-latest: true - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser - version: ${{ env.GITHUB_REF_NAME }} args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} diff --git a/.gitignore b/.gitignore index d75ad6a..edd1802 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ pkg/ *.zst sema/ src/ + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ae6f17d..5be6468 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,19 +1,23 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + builds: - - binary: sema - goos: + - goos: - windows - darwin - linux - goarch: - - amd64 - - arm64 env: - CGO_ENABLED=0 - - GO111MODULES=on release: prerelease: auto - + universal_binaries: - replace: true @@ -27,5 +31,32 @@ brews: name: Viktor A. Rozenko Voitenko email: sharp.vik@gmail.com +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 }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + checksum: - name_template: "checksums.txt" + name_template: 'checksums.txt' + +changelog: + sort: asc + filters: + exclude: + - '^docs' + - '^test' + +# The lines beneath this are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj diff --git a/main.go b/main.go index 9e1ff6b..d7d2f19 100644 --- a/main.go +++ b/main.go @@ -21,13 +21,13 @@ const ( tags = "tags" ) -var Version string //* Set during build. +var version string //* Set during build. var app = &cli.App{ Name: "sema", Usage: "Semantic commits made simple", Description: gitHubURL, - Version: Version, + Version: version, Authors: []*cli.Author{{ Name: "Viktor A. Rozenko Voitenko", Email: "sharp.vik@gmail.com",