From 089ed81b4ab7ba1e0fccfc4596c57d73c0f11af9 Mon Sep 17 00:00:00 2001 From: Nikola Knezevic Date: Wed, 12 Feb 2020 12:30:08 +0100 Subject: [PATCH] Implement a release process --- .github/workflows/release.yml | 24 +++++++++++++++++++++++ .goreleaser.yml | 37 +++++++++++++++++++++++++++++++++++ Makefile | 5 ++++- README.adoc | 15 ++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) 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..0afc0a4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: goreleaser + +on: + push: + tags: + - 'v[0-9]*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - 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.GORELEASER_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..29eb076 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,37 @@ +project_name: pulley + +before: + hooks: + - go mod download + - go mod tidy -v + - make lint +builds: +- + env: + - GO111MODULE=on + - CGO_ENABLED=0 + ldflags: + - -s -w + - -X github.com/knl/pulley/internal/version.Version={{ .Version }} + - -X github.com/knl/pulley/internal/version.Revision={{ .FullCommit }} + - -X github.com/knl/pulley/internal/version.BuildUser={{ .Env.USER }} + - -X github.com/knl/pulley/internal/version.BuildDate={{ .Date }} + goos: + - darwin + - linux + - freebsd + - openbsd + goarch: + - amd64 + - arm + - arm64 + # List of combinations of GOOS + GOARCH + GOARM to ignore. + # Default is empty. + ignore: + - goos: darwin + goarch: arm + - goos: darwin + goarch: arm64 +changelog: + # set it to true if you wish to skip the changelog generation + skip: true diff --git a/Makefile b/Makefile index 459e03a..e955e34 100644 --- a/Makefile +++ b/Makefile @@ -34,4 +34,7 @@ clean: rm -rf build dist rm -f $(BIN) -.PHONY: test fmt lint tidy clean build +test-release: + goreleaser release --rm-dist --skip-publish --snapshot + +.PHONY: test fmt lint tidy clean build test-release diff --git a/README.adoc b/README.adoc index cc8aae0..9e69531 100644 --- a/README.adoc +++ b/README.adoc @@ -4,6 +4,7 @@ A service to expose Prometheus metrics of your CI's validation of Pull Requests (PRs), using GitHub webhooks. image:https://github.com/knl/pulley/workflows/CI/badge.svg[CI] +image:https://github.com/knl/pulley/workflows/goreleaser/badge.svg[release] image:https://goreportcard.com/badge/github.com/knl/pulley[link=https://goreportcard.com/report/github.com/knl/pulley, alt=Go Report Card] image:https://codebeat.co/badges/56655dd4-44a7-45fd-9d33-0654b5a90452[link=https://codebeat.co/projects/github-com-knl-pulley-master] @@ -149,3 +150,17 @@ Prior to committing the code, you could run make to properly format and lint the code + +=== Managing releases + +Releases are managed with https://goreleaser.com/[goreleaser]. + +To create a new release, push a tag (for example, a version 0.1.0): + + git tag -a v0.1.0 -m "First release" + git push origin v0.1.0 + +To build a test release, without publishing, run: + + make test-release +