Files
dujiao-next/.goreleaser.yaml

104 lines
3.3 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.
version: 2
project_name: dujiao-next
# 前端在这里构建并拷进 internal/web/dist/,随后由 -tags=fullstack 的 go:embed 打进二进制。
# 放在 before hooks 而不是 CI step 里,是为了让本地 `goreleaser build --snapshot`
# 与 GitHub Actions 走完全相同的路径。执行前需要有 pnpm(见 .github/workflows/release.yml)。
#
# 注意:hooks 必须是纯字符串。带 cmd/dir/env 的结构化 hook 是 GoReleaser Pro 特性,
# OSS 版会在解析阶段就报 "cannot unmarshal !!map into string" 而整个发布中止。
# 因此换目录一律用 `sh -c 'cd X && ...'`,而不是 dir 字段。
# 另外 hooks 不经过 shell,`cd X && y` 这种写法必须显式包一层 sh -c 才会生效。
before:
hooks:
- go mod tidy
- sh -c 'cd frontend/admin && pnpm install --frozen-lockfile'
- sh -c 'cd frontend/user && pnpm install --frozen-lockfile'
# admin 用 fullstack 模式构建:base 为 './' 且注入 __DJ_ADMIN_BASE__ 占位符,
# 后端启动时按 web.admin_path 替换,使产物可挂载到任意自定义前缀。
- sh -c 'cd frontend/admin && pnpm run build:fullstack'
- sh -c 'cd frontend/user && pnpm run build'
- sh -c 'rm -rf internal/web/dist && mkdir -p internal/web/dist'
- sh -c 'cp -r frontend/admin/dist internal/web/dist/admin'
- sh -c 'cp -r frontend/user/dist internal/web/dist/user'
builds:
# 单一产物:内嵌 admin + user SPA,一个二进制跑完整服务。
- id: dujiao-next
env:
- CGO_ENABLED=0
main: ./cmd/server
binary: dujiao-next
# BuildType=release 是后台一键升级的开关:只有 CI 正式产物才允许自我替换,
# 本地 go build 的二进制版本号是占位值,放开会把开发者自己编译的产物覆盖掉。
ldflags:
- -s -w -X github.com/dujiao-next/internal/version.Version={{.Tag}} -X github.com/dujiao-next/internal/version.BuildType=release
flags:
- "-tags=release,fullstack"
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
archives:
- id: dujiao-next
ids:
- dujiao-next
formats: [tar.gz]
files:
- ./config.yml.example
- ./README.md
- ./scripts/dujiao-next-manager.sh
name_template: >-
{{ .ProjectName }}_
{{- .Tag }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
formats: [zip]
changelog:
sort: asc
groups:
- title: 🚀 Features
regexp: '^feat[(:]'
order: 0
- title: 🐛 Bug Fixes
regexp: '^fix[(:]'
order: 1
- title: ⚡ Performance
regexp: '^perf[(:]'
order: 2
- title: 🔨 Refactor
regexp: '^refactor[(:]'
order: 3
- title: 📝 Documentation
regexp: '^docs[(:]'
order: 4
- title: 其他
order: 999
filters:
exclude:
- '^test[(:]'
- '^chore[(:]'
- '^ci[(:]'
- '^build[(:]'
- 'Merge pull request'
- 'Merge branch'
release:
footer: >-
---
## 📚 Documentation(在线文档)
- [Installation Guide](https://dujiao-next.com/deploy/)
- [部署指南](https://dujiao-next.com/deploy/)