Files
SamWaf/.goreleaser.yaml
2025-10-23 17:28:01 +08:00

328 lines
12 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.
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
# pull samwaf web
- curl -L https://github.com/samwafgo/SamWafWeb/releases/latest/download/dist.tar.gz -o dist.tar.gz
- tar -zxvf dist.tar.gz
- rm -rf public/dist
- mv -f dist public
- rm -rf dist.tar.gz
builds:
# 正式发布版本 (Release builds)
- id: "samwaf_linux"
binary: "SamWafLinux64"
skip: '{{ if or (contains .Tag "linux") (contains .Tag "all") (contains .Tag "windows") (contains .Tag "win") (contains .Tag "macos") (contains .Tag "darwin") }}{{ and (not (contains .Tag "linux")) (not (contains .Tag "all")) }}{{ else }}false{{ end }}'
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
- CGO_CFLAGS=-Wno-unused-variable
goos:
- linux
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}
- -s -w
- -extldflags "-static"
- id: "samwaf_win"
binary: "SamWaf64"
skip: '{{ if or (contains .Tag "linux") (contains .Tag "all") (contains .Tag "windows") (contains .Tag "win") (contains .Tag "macos") (contains .Tag "darwin") }}{{ and (not (contains .Tag "windows")) (not (contains .Tag "win")) (not (contains .Tag "all")) }}{{ else }}false{{ end }}'
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
- CGO_CFLAGS=-Wno-unused-variable
goos:
- windows
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}
- -s -w
- -extldflags "-static"
- id: "samwaf_linux_arm64"
binary: "SamWafLinuxArm64"
skip: '{{ if or (contains .Tag "linux") (contains .Tag "all") (contains .Tag "windows") (contains .Tag "win") (contains .Tag "macos") (contains .Tag "darwin") }}{{ and (not (contains .Tag "linux")) (not (contains .Tag "arm64")) (not (contains .Tag "all")) }}{{ else }}false{{ end }}'
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
- CGO_CFLAGS=-Wno-unused-variable
goos:
- linux
goarch:
- arm64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}
- -s -w
- -extldflags "-static"
- id: "samwaf_darwin_amd64"
binary: "SamWafDarwinAmd64"
skip: '{{ if or (contains .Tag "linux") (contains .Tag "all") (contains .Tag "windows") (contains .Tag "win") (contains .Tag "macos") (contains .Tag "darwin") }}{{ and (not (contains .Tag "macos")) (not (contains .Tag "darwin")) (not (contains .Tag "all")) }}{{ else }}false{{ end }}'
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- MACOSX_DEPLOYMENT_TARGET=10.15
- CGO_CFLAGS=-Wno-unused-variable
- CGO_LDFLAGS=-mmacosx-version-min=10.15
goos:
- darwin
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}
- -s -w
- id: "samwaf_darwin_arm64"
binary: "SamWafDarwinArm64"
skip: '{{ if or (contains .Tag "linux") (contains .Tag "all") (contains .Tag "windows") (contains .Tag "win") (contains .Tag "macos") (contains .Tag "darwin") }}{{ and (not (contains .Tag "macos")) (not (contains .Tag "darwin")) (not (contains .Tag "all")) }}{{ else }}false{{ end }}'
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
- MACOSX_DEPLOYMENT_TARGET=11.0
- CGO_CFLAGS=-Wno-unused-variable
- CGO_LDFLAGS=-mmacosx-version-min=11.0
goos:
- darwin
goarch:
- arm64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}
- -s -w
# Debug版本 (Debug builds for troubleshooting only)
- id: "samwaf_linux_debug"
binary: "SamWafLinux64-DEBUG-SYMBOLS"
skip: '{{ and (not (contains .Tag "linux")) (not (contains .Tag "debug")) (not (contains .Tag "all")) (ne .Env.BUILD_LINUX "true") }}'
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
- CGO_CFLAGS=-Wno-unused-variable
goos:
- linux
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}-debug
- -extldflags "-static"
- id: "samwaf_win_debug"
binary: "SamWaf64-DEBUG-SYMBOLS"
skip: '{{ and (not (contains .Tag "windows")) (not (contains .Tag "win")) (not (contains .Tag "debug")) (not (contains .Tag "all")) (ne .Env.BUILD_WINDOWS "true") }}'
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
- CGO_CFLAGS=-Wno-unused-variable
goos:
- windows
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}-debug
- -extldflags "-static"
- id: "samwaf_linux_arm64_debug"
binary: "SamWafLinuxArm64-DEBUG-SYMBOLS"
skip: '{{ and (not (contains .Tag "linux")) (not (contains .Tag "arm64")) (not (contains .Tag "debug")) (not (contains .Tag "all")) (ne .Env.BUILD_LINUX "true") }}'
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
- CGO_CFLAGS=-Wno-unused-variable
goos:
- linux
goarch:
- arm64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}-debug
- -extldflags "-static"
- id: "samwaf_darwin_amd64_debug"
binary: "SamWafDarwinAmd64-DEBUG-SYMBOLS"
skip: '{{ and (not (contains .Tag "macos")) (not (contains .Tag "darwin")) (not (contains .Tag "debug")) (not (contains .Tag "all")) (ne .Env.BUILD_MACOS "true") }}'
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- MACOSX_DEPLOYMENT_TARGET=10.15
- CGO_CFLAGS=-Wno-unused-variable
- CGO_LDFLAGS=-mmacosx-version-min=10.15
goos:
- darwin
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}-debug
- id: "samwaf_darwin_arm64_debug"
binary: "SamWafDarwinArm64-DEBUG-SYMBOLS"
skip: '{{ and (not (contains .Tag "macos")) (not (contains .Tag "darwin")) (not (contains .Tag "debug")) (not (contains .Tag "all")) (ne .Env.BUILD_MACOS "true") }}'
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
- MACOSX_DEPLOYMENT_TARGET=11.0
- CGO_CFLAGS=-Wno-unused-variable
- CGO_LDFLAGS=-mmacosx-version-min=11.0
goos:
- darwin
goarch:
- arm64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RUNTIME_WIN7_VERSION=false
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}-debug
upx:
- # Whether to enable it or not.
#
# Templates: allowed.
enabled: false
# Filter by build ID.
ids: [samwaf_linux,samwaf_win]
# Compress argument.
# Valid options are from '1' (faster) to '9' (better), and 'best'.
compress: best
archives:
- id: "release_archives"
builds: ["samwaf_linux", "samwaf_win", "samwaf_linux_arm64", "samwaf_darwin_amd64", "samwaf_darwin_arm64"]
format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
{{.Tag}}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
- id: "debug_archives"
builds: ["samwaf_linux_debug", "samwaf_win_debug", "samwaf_linux_arm64_debug", "samwaf_darwin_amd64_debug", "samwaf_darwin_arm64_debug"]
format: tar.gz
# Debug版本使用特殊命名以DEBUG开头便于用户识别和分组
name_template: >-
DEBUG_{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
{{.Tag}}_SYMBOLS
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
changelog:
sort: asc
groups:
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: Others
order: 999
filters:
exclude:
- "^docs:"
- "^test:"
release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
# Whether to remove existing draft releases with the same name before creating a new one.
# Only effective if `draft` is set to true.
# Default: false.
replace_existing_draft: true
# Useful if you want to delay the creation of the tag in the remote.
# You can create the tag locally, but not push it, and run GoReleaser.
# It'll then set the `target_commitish` portion of the GitHub release to the value of this field.
# Only works on GitHub.
#
# Default: ''
target_commitish: "{{ .Commit }}"
# If set to auto, will mark the release as not ready for production in case there is an indicator for this in the tag e.g. v1.0.0-rc1 .
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: false
# What to do with the release notes in case there the release already exists.
#
# Valid options are:
# - `keep-existing`: keep the existing notes
# - `append`: append the current release notes to the existing notes
# - `prepend`: prepend the current release notes to the existing notes
# - `replace`: replace existing notes
#
# Default is `keep-existing`.
mode: append
# Header for the release body.
#
# Templates: allowed
header: |
## SamWaf Release {{.Tag}} ({{ .Date }})
# Footer for the release body.
#
# Templates: allowed
footer: |
---
### 📋 版本说明
- **正式版本**:推荐用户生产环境使用,经过优化,文件较小
- **测试版本Beta**:功能尝鲜,修正部分bug等
- **调试版本Debug**:仅供技术支持和问题排查使用,包含调试符号,文件较大(包含Debug字样)
### 🆘 技术支持
如遇到问题需要技术支持,请:
1. 优先使用正式版本,测试版本
2. 如需问题排查,可下载对应的调试版本
3. 提供详细的错误信息和日志