From 08d33621d50eae01a1c9a4262f0493a970127abf Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Mon, 25 Jul 2022 22:57:08 +1000 Subject: [PATCH] ci: add goreleaser workflow --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + .goreleaser.yaml | 28 +++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5e3c58a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: GoReleaser + +on: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Fetch all tags + run: git fetch --force --tags + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 60a7302..d1fbce2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.so *.dylib lancache-diagnostics +dist/ # Test binary, built with `go test -c` *.test diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..1f894d0 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,28 @@ +project_name: lancache-diagnostics +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + goarch: + - amd64 + gcflags: + - -trimpath + ldflags: + - -s -w +archives: + - id: lancache-diagnostics + name_template: "{{ .ProjectName}}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}" + format: tar.gz +snapshot: + name_template: "{{ .ProjectName}}-v{{ incpatch .Version }}" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:'