-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,69 @@ | ||
version: 1 | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
|
||
builds: | ||
- id: eatme | ||
binary: eatme | ||
main: ./cmd/eatme | ||
ldflags: | ||
- -s | ||
- -w | ||
- -X main.version={{.Summary}} | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
dir: cmd/eatme | ||
ldflags: "-s -w -X main.revision={{.Tag}}-{{.ShortCommit}}-{{.CommitDate}}" | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: freebsd | ||
goarch: arm | ||
- goos: freebsd | ||
goarch: arm64 | ||
- goos: windows | ||
goarch: arm | ||
- goos: windows | ||
goarch: arm64 | ||
|
||
brews: | ||
- name: eatme | ||
goarm: "6" | ||
goamd64: v3 | ||
- name: gol | ||
repository: | ||
owner: kulapard | ||
name: homebrew-tap | ||
branch: master | ||
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" | ||
url_template: "https://github.com/kulapard/go-eatme/releases/download/{{ .Tag }}/{{ .ArtifactName }}" | ||
commit_author: | ||
name: goreleaserbot | ||
email: taras+goreleaserbot@drapalyuk.com | ||
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" | ||
name: Taras Drapalyuk | ||
email: taras@drapalyuk.com | ||
commit_msg_template: "Brew formula update for `{{ .ProjectName }}` version `{{ .Tag }}`" | ||
folder: Formula | ||
homepage: "https://github.com/kulapard/go-eatme" | ||
description: "Simple tool to manage multiple git/hg repositories at once. It goes through all subdirectories recursively and concurrently execute specified command in all af them." | ||
license: "MIT" | ||
test: | | ||
system "#{bin}/eatme branch" | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
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 | ||
|
||
changelog: | ||
sort: asc | ||
|
||
checksum: | ||
name_template: 'checksums.txt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Get the latest commit branch, hash, and date | ||
TAG=$(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null) | ||
BRANCH=$(if $(TAG),$(TAG),$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)) | ||
BRANCH_SAFE=$(shell echo $(BRANCH) | sed -e 's/[^a-zA-Z0-9-]/-/g') | ||
HASH=$(shell git rev-parse --short=7 HEAD 2>/dev/null) | ||
TIMESTAMP=$(shell git log -1 --format=%ct HEAD 2>/dev/null | xargs -I{} date -u -r {} +%Y%m%dT%H%M%S) | ||
GIT_REV=$(shell printf "%s-%s-%s" "$(BRANCH_SAFE)" "$(HASH)" "$(TIMESTAMP)") | ||
REV=$(if $(filter --,$(GIT_REV)),latest,$(GIT_REV)) # fallback to latest if not in git repo | ||
|
||
|
||
all: lint test build release | ||
|
||
build: | ||
cd cmd/gol && go build -ldflags "-X main.revision=$(REV) -s -w" -o ../../.bin/gol.$(REV) | ||
cp .bin/gol.$(REV) .bin/gol | ||
.bin/gol --version | ||
|
||
release: | ||
@echo release to dist/ | ||
goreleaser --snapshot --clean | ||
|
||
test: | ||
go clean -testcache | ||
go test -v -coverprofile=coverage.out -covermode=atomic ./... | ||
go tool cover -func=coverage.out | ||
rm coverage.out | ||
|
||
lint: | ||
golangci-lint run | ||
|
||
version: | ||
@echo "branch: $(BRANCH), hash: $(HASH), timestamp: $(TIMESTAMP)" | ||
@echo "revision: $(REV)" | ||
|
||
.PHONY: build release test lint version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package main | ||
|
||
var ( | ||
version = "unknown-local-build" | ||
revision = "unknown" | ||
) | ||
|
||
func main() { | ||
Execute(version) | ||
Execute(revision) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters