Skip to content

Commit

Permalink
Use goreleaser's fine-grained control for releases (#376)
Browse files Browse the repository at this point in the history
Use goreleaser's fine-grained control for releases
  • Loading branch information
twpayne committed Jun 29, 2019
2 parents a2fc377 + c711405 commit 542a132
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 257 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
/chezmoi
/cmd/cmd-packr.go
/dist
/goreleaser/goreleaser.host.yaml
/goreleaser/snap.login
/packrd
49 changes: 43 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ before:
- go mod download

builds:
- id: chezmoi-cgo
binary: chezmoi
ldflags: "-s -w -X github.com/twpayne/chezmoi/cmd.VersionStr={{ .Version }} -X github.com/twpayne/chezmoi/cmd.Commit={{ .Commit }} -X github.com/twpayne/chezmoi/cmd.Date={{ .Date }}"
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
- id: chezmoi-nocgo
binary: chezmoi
env:
Expand All @@ -15,8 +24,6 @@ builds:
- darwin
- freebsd
- openbsd
# - dragonfly
# - netbsd
goarch:
- "386"
- amd64
Expand All @@ -31,18 +38,35 @@ builds:
goarch: "386"
- goos: linux
goarch: amd64
- id: chezmoi-cgo
- id: chezmoi-cgo-snap
binary: chezmoi
flags:
- -tags=snap
ldflags: "-s -w -X github.com/twpayne/chezmoi/cmd.VersionStr={{ .Version }} -X github.com/twpayne/chezmoi/cmd.Commit={{ .Commit }} -X github.com/twpayne/chezmoi/cmd.Date={{ .Date }}"
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
- id: chezmoi-nocgo-snap
binary: chezmoi
flags:
- -tags=snap
ldflags: "-s -w -X github.com/twpayne/chezmoi/cmd.VersionStr={{ .Version }} -X github.com/twpayne/chezmoi/cmd.Commit={{ .Commit }} -X github.com/twpayne/chezmoi/cmd.Date={{ .Date }}"
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- "386"
- arm64

archives:
- files:
- builds:
- chezmoi-cgo
- chezmoi-nocgo
files:
- LICENSE
- README.md
- completions/*
Expand All @@ -66,7 +90,10 @@ changelog:
- "Merge branch"

nfpms:
- vendor: "Tom Payne <twpayne@gmail.com>"
- builds:
- chezmoi-cgo
- chezmoi-nocgo
vendor: "Tom Payne <twpayne@gmail.com>"
homepage: "https://github.com/twpayne/chezmoi"
maintainer: "Tom Payne <twpayne@gmail.com>"
description: "Manage your dotfiles across multiple machines, securely."
Expand Down Expand Up @@ -112,4 +139,14 @@ brews:
bash_completion.install "completions/chezmoi-completion.bash"
zsh_completion.install "completions/chezmoi.zsh" => "_chezmoi"
fish_completion.install "completions/chezmoi.fish"
description: "Manage your dotfiles across multiple machines, securely."
description: "Manage your dotfiles across multiple machines, securely."

snapcrafts:
- builds:
- chezmoi-cgo-snap
- chezmoi-nocgo-snap
summary: "Manage your dotfiles across multiple machines, securely."
description: "Manage your dotfiles across multiple machines, securely."
publish: true
grade: stable
confinement: classic
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sudo: false
deploy:
- provider: script
skip_cleanup: true
script: make release-setup-travis release release-snap
script: make release-setup-travis release
on:
tags: true
condition: "$TRAVIS_OS_NAME = linux"
37 changes: 2 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: nothing
nothing:

all: .goreleaser.yaml completions generate
all: completions generate

.PHONY: completions
completions: \
Expand Down Expand Up @@ -36,18 +36,6 @@ generate:
go generate ./...
packr2

.goreleaser.yaml: goreleaser/goreleaser.yaml.tmpl internal/generate-goreleaser-yaml/main.go
go run ./internal/generate-goreleaser-yaml \
-host-arch amd64 \
-host-os linux \
$< > $@ \
|| ( rm -f $@ ; false )

goreleaser/goreleaser.host.yaml: goreleaser/goreleaser.yaml.tmpl internal/generate-goreleaser-yaml/main.go
go run ./internal/generate-goreleaser-yaml \
$< > $@ \
|| ( rm -f $@ ; false )

.PHONY: html-coverage
html-coverage:
go tool cover -html=coverage.out
Expand All @@ -73,17 +61,6 @@ release:
--rm-dist \
${GORELEASER_FLAGS}

.PHONY: release-snap
release-snap:
goreleaser release \
--config=goreleaser/goreleaser.snap.yaml \
--rm-dist \
--skip-publish \
${GORELEASER_FLAGS}
for snap in dist/*.snap ; do \
snapcraft push --release=stable $${snap} ; \
done

.PHONY: release-setup-travis
release-setup-travis:
sudo snap install goreleaser --classic
Expand All @@ -98,18 +75,8 @@ release-setup-travis:
--with goreleaser/snap.login

.PHONY: test-release
test-release: goreleaser/goreleaser.host.yaml
TRAVIS_BUILD_NUMBER=1 goreleaser release \
--config goreleaser/goreleaser.host.yaml \
--rm-dist \
--skip-publish \
--snapshot \
${GORELEASER_FLAGS}

.PHONY: test-release-snap
test-release-snap:
test-release:
TRAVIS_BUILD_NUMBER=1 goreleaser release \
--config goreleaser/goreleaser.snap.yaml \
--rm-dist \
--skip-publish \
--snapshot \
Expand Down
40 changes: 0 additions & 40 deletions goreleaser/goreleaser.snap.yaml

This file was deleted.

115 changes: 0 additions & 115 deletions goreleaser/goreleaser.yaml.tmpl

This file was deleted.

59 changes: 0 additions & 59 deletions internal/generate-goreleaser-yaml/main.go

This file was deleted.

0 comments on commit 542a132

Please sign in to comment.