Files
FileShare/.goreleaser.yaml
SKYMirror 84df9996cb
CI 测试 / go vet + go test (push) Successful in 49s
26.9:版本号统一 + CI 精简 + 前端产物重建
- 全项目版本号统一:v3.x 迭代号(26.9/26.9/26.9/26.9 及裸 v2/v3)→ 26.9,
  覆盖 Go 注释 / 文档 / openapi.yaml / README×4 / 前端源码(80+ 处)
- v31_test.go 更名 custom_code_test.go;TestV2AccessorDefaults → TestKVAccessorDefaults
- docs/api/00-overview.md 更新日志合并为单条 26.9 条目(修复错位拼接)
- .goreleaser.yaml 头部注释与实际一致(Pro 2.18.1 / GITEA_TOKEN / semver tag 要求)
- CI:release-image.yml → ci.yml,仅保留 vet+test 门禁;
  镜像发布移交 GoReleaser Pro(原 build-push 的 tag 校验与 26.9 版本方案冲突,历史 9 次失败)
- 前端重建:server/web/dist 与 web-embed 同步(docs 文案嵌入更新)
2026-09-08 03:16:51 +08:00

194 lines
6.8 KiB
YAML
Raw Permalink 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 配置(Pro 2.18.1,二进制在 ~/Code/Releaser/goreleaser
#
# 用法:
# goreleaser release --snapshot --clean --skip=publish # 本地试跑,产出 ./dist
# goreleaser release --clean # 正式发布(需 semver tag
#
# tag 必须是语义化版本(goreleaser 强制),如 v26.9.0(→ 版本 26.9.0),
# 并与 server/cmd/server/main.go 的 APP_VERSION 保持一致。
#
# 发布所需环境变量(不入库):
# GITEA_TOKEN Gitea Personal Access Tokenrelease + 资产上传)
# BUILDX_CONFIG=/tmp/buildx-config 可选:buildx 状态目录重定向(受限环境)
# DOCKER_CONFIG=/tmp/docker-config 可选:docker 配置重定向(manifest 需写 ~/.docker 时)
# ACR 登录:docker login registry.cn-hangzhou.aliyuncs.com(镜像推送用本机 docker 凭证)
#
# 产物:
# - 归档:linux/darwin/windows × amd64/arm64tar.gz + zip)→ Gitea Release
# - 镜像:registry.cn-hangzhou.aliyuncs.com/skymirror/fileshare:{版本}-amd64/-arm64
# + 多架构 manifest {版本} 与 latest → 阿里云 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 服务器(token 走 GITEA_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