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 # Mirrors the S3 `blobs:` upload above into Cloudflare R2 during the # parallel S3+R2 period (S3 will be removed once migration completes). # A second `blobs:` entry is impossible here since the blob pipe # authenticates from the global AWS_* env with no per-entry # credentials; `publishers:` supports per-entry `env:` instead, so # it's used to invoke scripts/upload-r2.sh once per artifact. Custom # publishers inherit almost nothing from the environment, hence the # explicit R2_* forwarding below. # # This publisher fires more than once per distinct key because # goreleaser's release pipe already registers `release.extra_files` # (./**.xz and ./**.xz.sha256, see the `release:` block below) as # UploadableFile artifacts, and `internal/exec`'s filterArtifacts # appends this block's own extra_files with no de-duplication. It # can't be globbed away, since gobwas/glob (via goreleaser/fileglob) # has no substring-exclusion matcher. It's harmless: PUT is # idempotent, and the `./**.xz` glob below is kept deliberately so # this publisher declares its own complete file set rather than # implicitly depending on the `release:` block's globs. # # checksum: true mirrors goreleaser's generated checksums.txt; # signature: true additionally mirrors checksums.txt.sig, which the # `signs:` block below produces by GPG-signing that checksum file. # Without signature: true, artifacts downloaded from the R2 mirror # would have no signature file to verify against. publishers: - name: cloudflare-r2 checksum: true signature: true extra_files: - glob: ./**.xz - glob: ./**.sha256 cmd: sh scripts/upload-r2.sh {{ abs .ArtifactPath }} tea/{{ .Version }}/{{ .ArtifactName }} env: - R2_ENDPOINT={{ index .Env "R2_ENDPOINT" }} - R2_BUCKET={{ index .Env "R2_BUCKET" }} - R2_ACCESS_KEY_ID={{ index .Env "R2_ACCESS_KEY_ID" }} - R2_SECRET_ACCESS_KEY={{ index .Env "R2_SECRET_ACCESS_KEY" }} 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