From 98910db519da91edd963fdd54a5b3047af29761f Mon Sep 17 00:00:00 2001 From: Colin O'Dell Date: Fri, 31 Dec 2021 11:57:58 -0500 Subject: [PATCH] Use goreleaser to automatically build and publish releases --- .github/workflows/releaser.yaml | 41 ++++++++++++++++ .gitignore | 2 + .goreleaser.yaml | 84 +++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 .github/workflows/releaser.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/releaser.yaml b/.github/workflows/releaser.yaml new file mode 100644 index 0000000..aaa91d5 --- /dev/null +++ b/.github/workflows/releaser.yaml @@ -0,0 +1,41 @@ +name: Release + +on: + pull_request: + push: + +permissions: + contents: write + +jobs: + releaser: + name: Release + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - + name: Test + run: go test -v ./... + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GH_PAT }} + - + name: Archive binaries + uses: actions/upload-artifact@v2 + with: + retention-days: 5 + path: dist diff --git a/.gitignore b/.gitignore index 527f9e6..5607003 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..bd880a4 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,84 @@ +project_name: go-check-ssl + +before: + hooks: + - go mod download + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - 386 + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + - goos: darwin + goarch: 386 + binary: '{{ .ProjectName }}' + ldflags: -s -w + flags: + - -trimpath + +archives: + - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + format_overrides: + - goos: windows + format: zip + files: + - README.md + - LICENSE + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +universal_binaries: + - replace: true + name_template: '{{ .ProjectName }}' + +release: + footer: | + **Full Changelog**: https://github.com/colinodell/go-check-ssl/compare/{{ .PreviousTag }}...{{ .Tag }} + +brews: + - tap: + owner: colinodell + name: homebrew-tap + commit_author: + name: Colin O'Dell + email: colinodell@gmail.com + folder: Formula + goarm: "7" + homepage: https://github.com/colinodell/go-check-ssl + description: Simple command line utility to check the status of an SSL certificate + license: MIT + install: |- + bin.install "{{ .ProjectName }}" + +nfpms: + - file_name_template: '{{ .ConventionalFileName }}' + id: packages + homepage: https://github.com/colinodell/go-check-ssl + description: Simple command line utility to check the status of an SSL certificate + maintainer: Colin O'Dell + license: MIT + vendor: Colin O'Dell + formats: + - apk + - deb + - rpm