Files
FileShare/.goreleaser.yaml
T
SKYMirror 80588a70dd
Release 镜像 / 测试(推送前置门禁) (push) Successful in 58s
Release 镜像 / 多架构构建并推送 ACR (push) Failing after 3s
release: GoReleaser Pro v2.18.1 发布配置
- .goreleaser.yaml:5 平台二进制(linux/darwin/windows × amd64/arm64)+
  tar.gz/zip 双格式归档 + 双架构 Docker 镜像(ACR registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare)
  + 多架构 manifest(版本号 + latest)+ Gitea Release 发布
- main.go:APP_VERSION 从 const 改 var,支持 -ldflags -X 注入发布版本;
  新增 BuildCommit/BuildDate 注入点
- dist/ 加入 .gitignore
2026-09-08 02:28:41 +08:00

185 lines
6.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 文件快传 GoReleaser 配置(OSS v2.14.1+
#
# 用法:
# goreleaser release --snapshot --clean # 本地试跑,产出 ./dist
# goreleaser release --clean # 正式发布(需 git tag + 远端可写)
#
# 注入凭据的环境变量(不入库):
# GORELEASER_GITEA_TOKEN Gitea Personal Access Tokenuploads + release
# GORELEASER_ACR_USER ACR 用户名
# GORELEASER_ACR_PASS ACR 密码
version: 2
project_name: fileshare
# 全局环境(goreleaser 会注入到所有 go build 子进程)。
# 把 GOMODCACHE 写死在 /tmp/.../goreleaser-pkg-mod,避开工作区下 server/.gomodcache
# 被 docker extra_files 拷进 context 时 macOS provenance xattr 触发的权限拒绝。
env:
- GOCACHE=/tmp/goreleaser-go-build
- GOMODCACHE=/tmp/goreleaser-pkg-mod
- GOSUMDB=off
- GOPROXY=https://goproxy.cn,direct
# 模块/入口:GoReleaser v2 不再在项目根找 main,须显式指到 server/cmd/server。
builds:
- id: server
main: ./cmd/server
dir: ./server
binary: fileshare-server
env:
- CGO_ENABLED=0
# GOCACHE/GOMODCACHE 由顶层 env: 注入
- GOSUMDB=off
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
# Windows ARM64 极少用,跳过以节省 CI 时间
ignore:
- goos: windows
goarch: arm64
flags:
- -trimpath
ldflags:
- -s -w
# 把版本号注入 main.APP_VERSIONconst → var),发布时由 .Version 提供
- -X 'main.APP_VERSION={{ .Version }}'
- -X 'main.BuildCommit={{ .ShortCommit }}'
- -X 'main.BuildDate={{ .Date }}'
mod_timestamp: '{{ .CommitTimestamp }}'
archives:
- id: default
formats:
- tar.gz
- zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
files:
- LICENSE*
- README*
- src: ./deploy/.env.example
dst: deploy
# Changelog:从 git tag 之间收集提交,按 kind 分组
changelog:
use: git
sort: asc
filters:
exclude:
- '^Merge '
- '^ci:'
- '^chore:'
- '^docs:'
- '^test:'
groups:
- title: '新功能'
regexp: '^.*?(feat|feature)(\(.+\))?!?:\s*.+'
order: 0
- title: '修复'
regexp: '^.*?(fix|bug)(\(.+\))?!?:\s*.+'
order: 1
- title: '性能 / 重构'
regexp: '^.*?(perf|refactor|revert)(\(.+\))?!?:\s*.+'
order: 2
- title: '构建 / CI'
regexp: '^.*?(build|ci)(\(.+\))?!?:\s*.+'
order: 3
- title: '其它'
order: 999
# ─────────────────────────────────────────────
# Docker 镜像(多架构)
# 使用现成的 deploy/Dockerfile(前端用 web-embed 预构建产物;缺失时容器内重建)
# extra_files 不列 .gocache/.gomodcachegoreleaser 默认仍会拷 . 下的隐藏目录;
# 已在 .dockerignore 排除,并由项目根 .dockerignore 屏蔽)
# ─────────────────────────────────────────────
dockers:
- id: server-amd64
use: buildx
goos: linux
goarch: amd64
dockerfile: deploy/Dockerfile
image_templates:
- 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}-amd64'
build_flag_templates:
- --platform=linux/amd64
- --build-arg=APK_MIRROR=https://mirrors.aliyun.com
- --build-arg=NPM_REGISTRY=https://registry.npmmirror.com
- --label=org.opencontainers.image.title=fileshare
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .ShortCommit }}
- --label=org.opencontainers.image.source=https://git.skymirror.top/SKYMirrorPublicTeam/FileShare
- --label=org.opencontainers.image.licenses=MIT
extra_files:
- server
- deploy
- web-embed
- web
- server/go.mod
- server/go.sum
- id: server-arm64
use: buildx
goos: linux
goarch: arm64
dockerfile: deploy/Dockerfile
image_templates:
- 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}-arm64'
build_flag_templates:
- --platform=linux/arm64
- --build-arg=APK_MIRROR=https://mirrors.aliyun.com
- --build-arg=NPM_REGISTRY=https://registry.npmmirror.com
- --label=org.opencontainers.image.title=fileshare
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .ShortCommit }}
- --label=org.opencontainers.image.source=https://git.skymirror.top/SKYMirrorPublicTeam/FileShare
- --label=org.opencontainers.image.licenses=MIT
extra_files:
- server
- deploy
- web-embed
- web
- server/go.mod
- server/go.sum
# 多架构 manifestamd64 / arm64 都推成功后合并成单一 manifest + latest 别名)
docker_manifests:
- name_template: 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}'
image_templates:
- 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}-amd64'
- 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}-arm64'
- name_template: 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:latest'
image_templates:
- 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}-amd64'
- 'registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{{ .Version }}-arm64'
# Gitea 服务器(v2.14 OSSgitea_urls 在顶层为对象;token 走 GORELEASER_TOKEN env
gitea_urls:
api: https://git.skymirror.top/api/v1
# 不推 Homebrew / nfpm / snap / flatpak
nfpms: []
brews: []
snapcrafts: []
aurs: []
scoops: []
chocolateys: []
# Gitea Release(把 archives 上传 + 创建 Release
release:
gitea:
owner: SKYMirrorPublicTeam
name: FileShare
draft: false
prerelease: 'auto'
name_template: '{{ .ProjectName }} {{ .Version }}'
header: |
## 文件快传 {{ .Version }}
完整变更列表见 [CHANGELOG](https://git.skymirror.top/SKYMirrorPublicTeam/FileShare/src/tag/{{ .Tag }}).
ids:
- default