mirror of
https://github.com/chainreactors/spray.git
synced 2025-06-20 09:50:21 +00:00
添加自动化编译
This commit is contained in:
parent
1a656b26a1
commit
2421c4178d
51
.github/workflows/gorelease.yml
vendored
Normal file
51
.github/workflows/gorelease.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{secrets.TOKEN}}
|
||||
submodules: recursive
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.17
|
||||
-
|
||||
name: Install upx
|
||||
run: sudo apt install upx -y
|
||||
continue-on-error: true
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist --skip-validate
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||
GOPATH: "/home/runner/go"
|
||||
|
||||
- name: upx
|
||||
run: upx dist/gogo*
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload assets
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: gogo_archive
|
||||
path: |
|
||||
dist/gogo*
|
||||
tools/*
|
||||
README.md
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "templates"]
|
||||
path = templates
|
||||
url = https://github.com/chainreactors/gogo-templates
|
58
.goreleaser.yml
Normal file
58
.goreleaser.yml
Normal file
@ -0,0 +1,58 @@
|
||||
project_name: spray
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
- go get sigs.k8s.io/yaml
|
||||
- go generate
|
||||
|
||||
builds:
|
||||
-
|
||||
main: .
|
||||
binary: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
|
||||
goos:
|
||||
- windows
|
||||
- linux
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- "386"
|
||||
- arm64
|
||||
ignore:
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
- goos: darwin
|
||||
goarch: "386"
|
||||
ldflags: "-s -w -X 'github.com/chainreactors/spray/cmd.ver=={{ .Tag }}'"
|
||||
flags:
|
||||
- -trimpath
|
||||
- -tags=forceposix
|
||||
asmflags:
|
||||
- all=-trimpath={{.Env.GOPATH}}
|
||||
gcflags:
|
||||
- all=-trimpath={{.Env.GOPATH}}
|
||||
no_unique_dist_dir: true
|
||||
|
||||
archives:
|
||||
-
|
||||
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
|
||||
format: binary
|
||||
replacements:
|
||||
amd64_v1: amd64
|
||||
|
||||
checksum:
|
||||
name_template: "{{ .ProjectName }}_checksums.txt"
|
||||
|
||||
changelog:
|
||||
sort: desc
|
||||
filters:
|
||||
exclude:
|
||||
- '^MERGE'
|
||||
- "{{ .Tag }}"
|
||||
- "^docs"
|
||||
|
||||
release:
|
||||
github:
|
||||
owner: chainreactors
|
||||
name: spray
|
||||
draft: true
|
@ -17,6 +17,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var ver = ""
|
||||
|
||||
func Spray() {
|
||||
var option internal.Option
|
||||
parser := flags.NewParser(&option, flags.Default)
|
||||
@ -49,6 +51,11 @@ func Spray() {
|
||||
return
|
||||
}
|
||||
|
||||
if option.Version {
|
||||
fmt.Println(ver)
|
||||
return
|
||||
}
|
||||
|
||||
if option.Format != "" {
|
||||
internal.Format(option.Format, !option.NoColor)
|
||||
os.Exit(0)
|
||||
|
@ -124,6 +124,7 @@ type MiscOptions struct {
|
||||
PoolSize int `short:"P" long:"pool" default:"5" description:"Int, Pool size"`
|
||||
Threads int `short:"t" long:"thread" default:"20" description:"Int, number of threads per pool"`
|
||||
Debug bool `long:"debug" description:"Bool, output debug info"`
|
||||
Version bool `short:"v" long:"version" description:"Bool, show version"`
|
||||
Quiet bool `short:"q" long:"quiet" description:"Bool, Quiet"`
|
||||
NoColor bool `long:"no-color" description:"Bool, no color"`
|
||||
NoBar bool `long:"no-bar" description:"Bool, No progress bar"`
|
||||
|
1
templates
Submodule
1
templates
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 241a707ce2a8d32b8bc96ebb5a06bcfdecb54b24
|
Loading…
x
Reference in New Issue
Block a user