install.fairie/.config/taskfiles/go/Taskfile-goreleaser.yml
Brian Zalewski f42899b107 Latest
2022-12-24 15:04:59 -05:00

58 lines
1.8 KiB
YAML

---
version: '3'
vars:
GORELEASER_CONFIG:
sh: if [ -f .goreleaser.yml ]; then echo ".goreleaser.yml"; else echo ".config/goreleaser-{{OS}}.yml"; fi
tasks:
build:
deps:
- :install:go:goreleaser
- :install:go:nfpm
- :install:software:jq
vars:
CURRENT_TAG:
sh: jq -r '.blueprint.currentBuildTag' package.json
log:
error: GoReleaser encountered an error (config file -> `{{.GORELEASER_CONFIG}}`)
start: Building with project with GoReleaser
success: Completed building the project with GoReleaser
cmds:
- |
unset GITHUB_TOKEN
unset GITLAB_TOKEN
export GOVERSION="$(go version)"
if [ '{{.CURRENT_TAG}}' != 'null' ]; then
export GORELEASER_CURRENT_TAG={{.CURRENT_TAG}}
fi
goreleaser build --config {{.GORELEASER_CONFIG}} --rm-dist --skip-validate
check:
deps:
- :install:go:goreleaser
log:
error: GoReleaser configuration appears to be invalid (config file -> `{{.GORELEASER_CONFIG}})
start: Validating the configuration file
success: GoReleaser configuration is valid!
cmds:
- goreleaser check --config {{.GORELEASER_CONFIG}}
release:
deps:
- :install:go:goreleaser
- :install:go:nfpm
- :install:software:jq
vars:
CURRENT_TAG:
sh: jq -r '.version' package.json
cmds:
- .config/log start 'Publishing compiled assets with GoReleaser'
- task: :publish:snap:register
- |
unset GITLAB_TOKEN
export GOVERSION="$(go version)"
export GORELEASER_CURRENT_TAG=v{{.CURRENT_TAG}}
goreleaser release --config {{.GORELEASER_CONFIG}} --rm-dist --skip-validate
- rm -f build/task.rb build/config.yaml
- .config/log success 'Successfully published assets with GoReleaser!'