gitea.tea/.goreleaser.yaml
Lunny Xiao bade1de792 ci(goreleaser): migrate release config to goreleaser v2
goreleaser v1 is EOL; v2 is the current supported major line, so move
the release pipeline over before adding any further release changes.
This is a purely mechanical syntax migration with no behavioral intent
beyond staying on a supported version.

.goreleaser.yaml:
- add top-level `version: 2` (required by goreleaser v2)
- rename `blobs[].folder` to `blobs[].directory`
- rename `snapshot.name_template` to `snapshot.version_template`
- rename `nightly.name_template` to `nightly.version_template`
  (goreleaser-pro only block)

.gitea/workflows/release-tag.yml and release-nightly.yml:
- bump the goreleaser-action `version` pin from `~> v1` to `~> v2`

All other keys (force_token, gitea_urls, builds.no_unique_dist_dir,
checksum.extra_files, signs, release.extra_files, etc.) are valid
as-is under v2 and are left untouched.

`goreleaser check` still reports `DEPRECATED: archives.format should
not be used anymore`. This predates this change and is orthogonal to
the v1->v2 migration, so it is intentionally left unfixed here.

Verified locally with goreleaser v2 OSS (2.11.2):
- `goreleaser check -f .goreleaser.yaml` fails with `field nightly not
  found in type config.Project`, as expected since `nightly` is a
  goreleaser-pro-only key and the local binary is OSS.
- copied the config to a scratch file with the `nightly:` block
  stripped and ran `goreleaser check -f <scratch>` from inside this
  worktree: `configuration is valid, but uses deprecated properties`
  (only the pre-existing archives.format warning). Scratch file was
  deleted afterwards and was never committed.
- using the same scratch file, ran a real build smoke test:
  `SDK_VERSION=$(go list -f '{{.Version}}' -m gitea.dev/sdk) goreleaser
  build --snapshot --clean --single-target -f <scratch>`, which
  succeeded end-to-end including the xz and checksum post hooks;
  `dist/` (git-ignored) was removed afterwards.
- validated .goreleaser.yaml, release-tag.yml and release-nightly.yml
  with python3's yaml.safe_load.

---
Generated by Codet
2026-07-25 19:04:52 -07:00

125 lines
2.5 KiB
YAML

version: 2
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
- freebsd
goarch:
- amd64
- arm
- arm64
goarm:
- "5"
- "6"
- "7"
ignore:
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le
- goos: darwin
goarch: s390x
- goos: windows
goarch: ppc64le
- goos: windows
goarch: s390x
- goos: windows
goarch: arm
goarm: "5"
- goos: windows
goarch: arm
goarm: "6"
- goos: windows
goarch: arm
goarm: "7"
- goos: freebsd
goarch: ppc64le
- goos: freebsd
goarch: s390x
- goos: freebsd
goarch: arm
goarm: "5"
- goos: freebsd
goarch: arm
goarm: "6"
- goos: freebsd
goarch: arm
goarm: "7"
- goos: freebsd
goarch: arm64
flags:
- -trimpath
ldflags:
- -s -w -X "gitea.dev/tea/modules/version.Version={{ trimprefix .Summary "v" }}" -X "gitea.dev/tea/modules/version.Tags=" -X "gitea.dev/tea/modules/version.SDK={{ .Env.SDK_VERSION }}"
binary: >-
{{ .ProjectName }}-
{{- .Version }}-
{{- .Os }}-
{{- if eq .Arch "amd64" }}amd64
{{- else if eq .Arch "amd64_v1" }}amd64
{{- else if eq .Arch "386" }}386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}-{{ .Arm }}{{ end }}
no_unique_dist_dir: true
hooks:
post:
- cmd: xz -k -9 {{ .Path }}
dir: ./dist/
- cmd: sh .goreleaser.checksum.sh {{ .Path }}
- cmd: sh .goreleaser.checksum.sh {{ .Path }}.xz
blobs:
-
provider: s3
bucket: "{{ .Env.S3_BUCKET }}"
region: "{{ .Env.S3_REGION }}"
directory: "tea/{{.Version}}"
extra_files:
- glob: ./**.xz
- glob: ./**.sha256
archives:
- format: binary
name_template: "{{ .Binary }}"
allow_different_binary_count: true
checksum:
name_template: 'checksums.txt'
extra_files:
- glob: ./**.xz
force_token: gitea
signs:
-
signature: "${artifact}.sig"
artifacts: checksum
stdin: '{{ .Env.GPGSIGN_PASSPHRASE }}'
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
snapshot:
version_template: "{{ .Branch }}-devel"
nightly:
version_template: "{{ .Branch }}"
gitea_urls:
api: https://gitea.com/api/v1
download: https://gitea.com
release:
extra_files:
- glob: ./**.xz
- glob: ./**.xz.sha256
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj