Update goreleaser config

This commit is contained in:
Evan Fiordeliso 2023-04-15 18:24:23 -04:00
parent 4a9b568f6c
commit 06eaade72b
5 changed files with 81 additions and 6 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
# Deployment directory # Deployment directory
.deploy .deploy
dist/

48
.goreleaser.yaml Normal file
View File

@ -0,0 +1,48 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
- -X go.fifitido.net/ytdl-web/version.Version={{.Version}}
- -X go.fifitido.net/ytdl-web/version.Build={{.Commit}}
- -X go.fifitido.net/ytdl-web/version.BuildDate={{.Date}}
- -X go.fifitido.net/ytdl-web/version.BuiltBy=goreleaser
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
checksum:
name_template: checksums.txt
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
gitea_urls:
api: https://git.fifitido.net/api/v1
download: https://git.fifitido.net
# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

View File

@ -36,9 +36,27 @@ task deps
task build task build
``` ```
## Releasing
Prerequisites:
- [go v1.20](https://go.dev/doc/install)
- [goreleaser](https://goreleaser.com/install/)
- [task cli](https://taskfile.dev/installation/)
Steps:
1. Ensure gitea access token is in `~/.config/goreleaser/gitea_token`
2. Run release task
```sh
task release
```
## Publishing Docker Image ## Publishing Docker Image
Prerequsites: Prerequisites:
- [docker](https://docs.docker.com/engine/install/) - [docker](https://docs.docker.com/engine/install/)
- [task cli](https://taskfile.dev/installation/) - [task cli](https://taskfile.dev/installation/)
@ -59,7 +77,7 @@ task docker:publish
## Publishing Chart ## Publishing Chart
Prerequsites: Prerequisites:
- [helm cli](https://helm.sh/docs/intro/install/) - [helm cli](https://helm.sh/docs/intro/install/)
- [cm-push helm plugin](https://github.com/chartmuseum/helm-push/). - [cm-push helm plugin](https://github.com/chartmuseum/helm-push/).

View File

@ -6,14 +6,18 @@ vars:
VERSION_PKG: go.fifitido.net/ytdl-web/version VERSION_PKG: go.fifitido.net/ytdl-web/version
BUILD: BUILD:
sh: git rev-parse --short HEAD sh: git rev-parse --short HEAD
DATE:
sh: date
DOCKER_IMAGE: git.fifitido.net/apps/ytdl-web DOCKER_IMAGE: git.fifitido.net/apps/ytdl-web
DOCKER_IMAGE_TAG: latest DOCKER_IMAGE_TAG: latest
tasks: tasks:
deps: go mod download deps: go mod download
tidy: go mod tidy tidy: go mod tidy
build: go build -ldflags="-X {{.VERSION_PKG}}.Version={{.VERSION}} -X {{.VERSION_PKG}}.Build={{.BUILD}}" -o {{.OUT}} . check: goreleaser check
build: goreleaser build --single-target
dev: air dev: air
release: goreleaser release
chart:publish: helm cm-push charts/ytdl-web/ gitea-apps chart:publish: helm cm-push charts/ytdl-web/ gitea-apps

View File

@ -1,4 +1,8 @@
package version package version
var Version string var (
var Build string Version string
Build string
BuildDate string
BuiltBy string
)