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
This commit is contained in:
Lunny Xiao 2026-07-25 19:04:52 -07:00
parent 73b6bf3e23
commit bade1de792
3 changed files with 7 additions and 5 deletions

View file

@ -28,7 +28,7 @@ jobs:
uses: goreleaser/goreleaser-action@v7 uses: goreleaser/goreleaser-action@v7
with: with:
distribution: goreleaser-pro distribution: goreleaser-pro
version: "~> v1" version: "~> v2"
args: release --nightly args: release --nightly
env: env:
SDK_VERSION: ${{ steps.sdk_version.outputs.version }} SDK_VERSION: ${{ steps.sdk_version.outputs.version }}

View file

@ -29,7 +29,7 @@ jobs:
uses: goreleaser/goreleaser-action@v7 uses: goreleaser/goreleaser-action@v7
with: with:
distribution: goreleaser-pro distribution: goreleaser-pro
version: "~> v1" version: "~> v2"
args: release args: release
env: env:
SDK_VERSION: ${{ steps.sdk_version.outputs.version }} SDK_VERSION: ${{ steps.sdk_version.outputs.version }}

View file

@ -1,3 +1,5 @@
version: 2
before: before:
hooks: hooks:
- go mod tidy - go mod tidy
@ -79,7 +81,7 @@ blobs:
provider: s3 provider: s3
bucket: "{{ .Env.S3_BUCKET }}" bucket: "{{ .Env.S3_BUCKET }}"
region: "{{ .Env.S3_REGION }}" region: "{{ .Env.S3_REGION }}"
folder: "tea/{{.Version}}" directory: "tea/{{.Version}}"
extra_files: extra_files:
- glob: ./**.xz - glob: ./**.xz
- glob: ./**.sha256 - glob: ./**.sha256
@ -104,10 +106,10 @@ signs:
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"] args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
snapshot: snapshot:
name_template: "{{ .Branch }}-devel" version_template: "{{ .Branch }}-devel"
nightly: nightly:
name_template: "{{ .Branch }}" version_template: "{{ .Branch }}"
gitea_urls: gitea_urls:
api: https://gitea.com/api/v1 api: https://gitea.com/api/v1