From 4c7bc03c3ead5e84250d4f95d76359871e7dca9c Mon Sep 17 00:00:00 2001 From: Pina Date: Sat, 16 May 2020 16:00:52 +0100 Subject: [PATCH] goreleaser github action --- .github/workflows/main.yml | 38 ++++++++++++++++++++++++++++++++++++-- .goreleaser.yml | 31 +++++++++++++++++++++++++++++++ go.mod | 2 ++ main.go | 4 ++++ 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 21eb8f7..41fb6fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,2 +1,36 @@ -- name: Go Release Binary - uses: ngs/go-release.action@v1.0.2 +name: release + +on: + push: + branches-ignore: + - '**' + tags: + - 'v*.*.*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@master + - + name: Set up Go + uses: actions/setup-go@master + with: + go-version: 1.13.x + - + name: Prepare + id: prepare + run: | + TAG=${GITHUB_REF#refs/tags/} + echo ::set-output name=tag_name::${TAG} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.prepare.outputs.tag_name }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..802d1cf --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,31 @@ +before: + hooks: + - go mod tidy +builds: +- env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm + goarm: + - 7 +archives: +- format_overrides: + - goos: windows + format: zip + files: + - none* +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Env.VERSION }}" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/go.mod b/go.mod index 0f868b4..8867306 100644 --- a/go.mod +++ b/go.mod @@ -1 +1,3 @@ module github.com/jsha/minica + +go 1.13 diff --git a/main.go b/main.go index 9734969..f5dd46a 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,9 @@ import ( "time" ) +var version string = "DEV" +var date string + func main() { err := main2() if err != nil { @@ -310,6 +313,7 @@ the certificate, or the first IP address if no domain names are present. It will not overwrite existing keys or certificates. `) + fmt.Fprintf(os.Stderr, "version %v (built on %v)\n\n", version, date) flag.PrintDefaults() } flag.Parse()