From 6d548fd8bc5a6eecaabd931f8d8f77a6681050c2 Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Tue, 15 Dec 2020 16:39:30 +0100 Subject: [PATCH] ci: refinements to release process Signed-off-by: Leonardo Di Donato --- .github/workflows/release.yaml | 2 +- .goreleaser.yml | 19 +++++++++++-------- makefile | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 51bd1ff..2c847a9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -21,6 +21,6 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: version: latest - args: release + args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index c5676af..5109622 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,18 +1,21 @@ project_name: maintainers-generator +checksum: + disable: true +dist: bin builds: - id: "maintainers-generator" goos: - - linux + - linux goarch: - - amd64 - - 386 - main: ./bin/maintainers-generator - env: - - CGO_ENABLED=0 - binary: maintainers-generator + - amd64 + hooks: + post: + - make build + - cat /tmp/.maintainers-generator-stderr.txt + - mv -f bin/maintainers-generator bin/maintainers-generator_linux_amd64/ changelog: sort: asc filters: exclude: - - '^deps:' \ No newline at end of file + - "^deps:" diff --git a/makefile b/makefile index 9d29ef1..6b4a063 100644 --- a/makefile +++ b/makefile @@ -1,29 +1,29 @@ SHELL := /bin/bash # Make is verbose in Linux. Make it silent. -MAKEFLAGS += --silent +# MAKEFLAGS += --silent VERSION := $(shell git describe --tags 2> /dev/null || echo "0.0.0") BUILD := $(shell git rev-parse --short HEAD 2> /dev/null) COMMIT := $(if $(shell git status --porcelain --untracked-files=no),${BUILD}-dirty,${BUILD}) -PROJECTNAME := $(shell basename "$(PWD)") +PROJECTNAME := "maintainers-generator" BASE := $(shell pwd) OUTPUT := $(BASE)/bin # Go variables GOFILES := $(wildcard *.go) -LDFLAGS=-ldflags "-X=github.com/leodido/maintainers-generator/pkg/version.version=$(VERSION) -X=github.com/leodido/maintainers-generator/pkg/version.commit=$(COMMIT)" +LDFLAGS=-ldflags "-X=github.com/leodido/$(PROJECTNAME)/pkg/version.version=$(VERSION) -X=github.com/leodido/$(PROJECTNAME)/pkg/version.commit=$(COMMIT)" # Redirect error output to a file, so we can show it in development mode. -STDERR := /tmp/.$(PROJECTNAME)-stderr.txt +STDERR := "/tmp/.$(PROJECTNAME)-stderr.txt" build: $(GOFILES) - @echo " > Building binary..." - @-touch $(STDERR) - @-rm $(STDERR) - @mkdir -p $(OUTPUT) - @go build $(LDFLAGS) -o $(OUTPUT)/$(PROJECTNAME) $(GOFILES) 2> $(STDERR) - @cat $(STDERR) | sed -e '1s/.*/\nError:\n/' | sed 's/make\[.*/ /' | sed "/^/s/^/ /" 1>&2 + echo " > Building binary from: $(GOFILES)" + touch $(STDERR) + rm $(STDERR) + mkdir -p $(OUTPUT) + go build $(LDFLAGS) -o "$(OUTPUT)/$(PROJECTNAME)" $(GOFILES) 2> $(STDERR) + cat $(STDERR) | sed -e '1s/.*/\nError:\n/' | sed 's/make\[.*/ /' | sed "/^/s/^/ /" 1>&2 test: @echo " > Executing tests..."