From 3889e3a6e291a99074a091f6e3e34e223339cadb Mon Sep 17 00:00:00 2001 From: Aiden Keating Date: Thu, 30 Jan 2020 08:27:04 +0000 Subject: [PATCH] add goreleaser to push binaries on each tag currently, to make binaries for the smtp-service cli available they must be manually built. this will eventually lead to human error and inconsistencies in the release format. this commit adds a github workflow that will be performed on each tag of the repo that will run the goreleaser tool. this will build and push binaries to github releases automatically. verification: - create a new tag - ensure the release workflow starts on github - ensure new binaries are pushed for the new tag --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ .gitignore | 9 ++++++++- .goreleaser.yml | 23 +++++++++++++++++++++++ Makefile | 4 ++++ README.md | 8 +++++++- 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..16b1768 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: goreleaser +on: + push: + tags: + - '*' +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Unshallow + run: git fetch --prune --unshallow + - + name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.13.x + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 760f605..be5812d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,12 @@ _testmain.go *.test *.prof +## Builds +cli + +## Goland .idea -cli \ No newline at end of file + +## Goreleaser +dist/ +bin/ \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..1575a4d --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,23 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +builds: +- main: ./cmd/cli/main.go + env: + - CGO_ENABLED=0 +archives: +- replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/Makefile b/Makefile index a6a4303..e47c17d 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,7 @@ vendor/check: vendor/fix vendor/fix: go mod tidy go mod vendor + +.PHONY: setup/goreleaser +setup/goreleaser: + curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh \ No newline at end of file diff --git a/README.md b/README.md index 17bb13d..e12bfed 100644 --- a/README.md +++ b/README.md @@ -80,4 +80,10 @@ To run unit tests, run: ``` make test/unit -``` \ No newline at end of file +``` + +## Releases + +New binaries for a release tag will be created by [GoReleaser](https://goreleaser.com/) automatically. + +To try out GoReleaser locally, it can be installed using `make setup/goreleaser`. \ No newline at end of file