Skip to content

Commit

Permalink
ci: refinements to release process
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
  • Loading branch information
leodido committed Dec 15, 2020
1 parent 3018822 commit 6d548fd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
19 changes: 11 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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:'
- "^deps:"
20 changes: 10 additions & 10 deletions makefile
Original file line number Diff line number Diff line change
@@ -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..."
Expand Down

0 comments on commit 6d548fd

Please sign in to comment.