install.fairie/.config/taskfiles/go/Taskfile-goreleaser.yml

59 lines
1.8 KiB
YAML
Raw Normal View History

2022-12-24 12:04:59 -08:00
---
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!'