From 115024e1f2da4d62a62d377424a5c1884db60d42 Mon Sep 17 00:00:00 2001
From: Christoph Witzko <github@christophwitzko.com>
Date: Sun, 22 May 2022 18:38:37 +0200
Subject: [PATCH] feat: use goreleaser

---
 .github/workflows/ci.yml | 15 +--------------
 .goreleaser.yaml         | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 14 deletions(-)
 create mode 100644 .goreleaser.yaml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 08ef49d..11d42c1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -37,21 +37,8 @@ jobs:
       - uses: actions/setup-go@v3
         with:
           go-version: 1.18
-      - run: |
-          go install github.com/mitchellh/gox@latest
-          go install github.com/tcnksm/ghr@latest
       - uses: go-semantic-release/action@v1
-        id: semrel
         with:
-          github-token: ${{ secrets.GITHUB_TOKEN }}
-          ghr: true
-      - run: |
-          gox -parallel 4 -osarch="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 linux/arm windows/amd64" -ldflags="-extldflags '-static' -s -w -X github.com/go-semantic-release/condition-default/pkg/condition.CIVERSION=${{steps.semrel.outputs.version}}" -output="bin/{{.Dir}}_v${{steps.semrel.outputs.version}}_{{.OS}}_{{.Arch}}" ./cmd/condition-default/
-          cd bin/ && shasum -a 256 * > ./condition-default_v${{steps.semrel.outputs.version}}_checksums.txt && cd -
-        if: steps.semrel.outputs.version != ''
-        env:
-          CGO_ENABLED: 0
-      - run: ghr $(cat .ghr) bin/
-        if: steps.semrel.outputs.version != ''
+          hooks: goreleaser
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
new file mode 100644
index 0000000..40f2c28
--- /dev/null
+++ b/.goreleaser.yaml
@@ -0,0 +1,21 @@
+builds:
+  - env:
+      - CGO_ENABLED=0
+    targets:
+      - linux_amd64
+      - linux_arm64
+      - darwin_amd64
+      - darwin_arm64
+      - linux_arm
+      - windows_amd64
+    main: ./cmd/condition-default/
+    ldflags:
+      - -extldflags '-static'
+      - -s -w -X github.com/go-semantic-release/condition-default/pkg/condition.CIVERSION={{.Version}}
+
+archives:
+  - format: binary
+    name_template: '{{ .Binary }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}'
+
+checksum:
+  name_template: '{{ .ProjectName }}_v{{ .Version }}_checksums.txt'
-- 
GitLab