build:测试 goreleaser发布

This commit is contained in:
samwaf
2024-08-02 15:58:20 +08:00
parent 7dc85248f5
commit 801caa3841
3 changed files with 125 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
name: goreleaser
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
+2 -1
View File
@@ -9,4 +9,5 @@
/data/local_log.db-wal
/data/local_stats.db-shm
/data/local_stats.db-wal
registration_data.bin
registration_data.bin
dist/
+89
View File
@@ -0,0 +1,89 @@
# 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 ./...
builds:
- id: "samwaf"
env:
- CGO_ENABLED=1
- GOPROXY=https://goproxy.cn,direct
goos:
- windows
goarch:
- amd64
ldflags:
- -X SamWaf/global.GWAF_RELEASE=true
- -X SamWaf/global.GWAF_RELEASE_VERSION_NAME={{ time "20060102" }}
- -X SamWaf/global.GWAF_RELEASE_VERSION={{.Tag}}
- -s -w
- -extldflags "-static"
upx:
- # Whether to enable it or not.
#
# Templates: allowed.
enabled: false
# Filter by build ID.
ids: [samwaf]
# Filter by GOOS.
goos: [windows]
# Filter by GOARCH.
goarch: [amd64]
# Filter by GOAMD64.
goamd64: [v1]
# Compress argument.
# Valid options are from '1' (faster) to '9' (better), and 'best'.
compress: best
# Whether to try LZMA (slower).
lzma: true
# Whether to try all methods and filters (slow).
brute: true
archives:
- 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
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:"