From ac3839a8eb152f64a6ad45f710e4171efd77b668 Mon Sep 17 00:00:00 2001 From: spiritysdx Date: Thu, 4 Jul 2024 18:53:11 +0800 Subject: [PATCH] update --- .github/workflows/main.yaml | 1 - .goreleaser.yaml | 50 +++++++++++++++++++++++++++++++++++++ goecs.sh | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 55adeef..0c9601c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -35,4 +35,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GHT }} GOPRIVATE: github.com/oneclickvirt/security - CGO_ENABLED: 0 # 禁用 CGO,强制静态链接 diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..1e69d21 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,50 @@ +before: + hooks: + - go mod download + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 # 禁用 CGO,强制静态链接 + goos: + - linux + - windows + - darwin + - openbsd + - freebsd + goarch: + - amd64 + - arm + - arm64 + - 386 + - s390x + - ppc64 + - ppc64le + - riscv64 + - mips + - mips64 + - mipsle + - mips64le + - loong64 + goarm: + - 5 + - 6 + - 7 + gomips: + - hardfloat + - softfloat + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{ .CommitDate }} +archives: + - name_template: >- + {{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "openbsd" }}OpenBSD{{ else }}{{ title .Os }}{{ end }}_{{ if eq .Arch "386" }}i386{{ else if eq .Arch "amd64" }}x86_64{{ else }}{{ .Arch }}{{ end }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }} + +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' \ No newline at end of file diff --git a/goecs.sh b/goecs.sh index f026fd7..b3388b3 100644 --- a/goecs.sh +++ b/goecs.sh @@ -80,7 +80,7 @@ goecs_check() { cdn_urls=("https://cdn0.spiritlhl.top/" "http://cdn3.spiritlhl.net/" "http://cdn1.spiritlhl.net/" "http://cdn2.spiritlhl.net/") check_cdn_file case $os in - Linux) + Linux|FreeBSD) case $arch in "x86_64" | "x86" | "amd64" | "x64") wget -O goecs.tar.gz "${cdn_success_url}https://github.com/oneclickvirt/ecs/releases/download/v${ECS_VERSION}/ecs_${ECS_VERSION}_linux_amd64.tar.gz"