From 6fe56423ab95fadb9c69da0ae3ebdba0871c1f15 Mon Sep 17 00:00:00 2001
From: Lakshay Kalbhor <lakshaykalbhor@gmail.com>
Date: Tue, 16 Jan 2024 17:28:01 +0530
Subject: [PATCH] chore: add goreleaser

---
 .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++
 .goreleaser.yml               | 16 +++++++++-------
 2 files changed, 40 insertions(+), 7 deletions(-)
 create mode 100644 .github/workflows/release.yml

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..8a9e9d5
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,31 @@
+name: goreleaser
+
+on:
+  push:
+    tags:
+      - "v*" # Will trigger only if tag is pushed matching pattern `v*` (Eg: `v0.1.0`)
+
+permissions:
+  contents: write
+
+jobs:
+  goreleaser:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Set up Go
+        uses: actions/setup-go@v4
+        with:
+          go-version: "1.21"
+
+      - name: Run GoReleaser
+        uses: goreleaser/goreleaser-action@v4
+        with:
+          version: latest
+          args: release --clean
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 10620f7..e5c9220 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -1,22 +1,24 @@
-env:
-  - CGO_ENABLED=1
-
 before:
   hooks:
-  - make dist
-
+    - go mod tidy
+  
 builds:
-  - binary: kaf-relay.bin
-    main: .
+  - env:
+      - CGO_ENABLED=1
+    binary: kaf-relay
     goos:
       - windows
       - linux
+      - freebsd
+      - openbsd
       - netbsd
     goarch:
       - amd64
 
 archives:
   - format: tar.gz
+    rlcp: true
     files:
+      - config.toml.sample
       - README.md
       - LICENSE
\ No newline at end of file