From 876b9535b952fbe36fcc1353aa4116fb279e21eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tolga=20O=CC=88zen?= <mtolgaozen@gmail.com>
Date: Fri, 21 Oct 2022 01:05:47 +0300
Subject: [PATCH] goreleaser update

---
 .github/workflows/release.yml |   5 +-
 .goreleaser.yml               | 134 ++++++++++++++++++----------------
 2 files changed, 72 insertions(+), 67 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b594ca579..fb0660ae3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -16,7 +16,6 @@ jobs:
         with:
           fetch-depth: 0
       - name: Set up QEMU
-        id: qemu
         uses: docker/setup-qemu-action@v2
       - name: Log in to GHCR
         uses: docker/login-action@v2
@@ -24,10 +23,10 @@ jobs:
           registry: ghcr.io
           username: ${{ github.actor }}
           password: ${{ secrets.GH_PAT }}
-      - name: Install Go
+      - name: Set up Go
         uses: actions/setup-go@v3
         with:
-          go-version: '1.18'
+          go-version: 1.18
       - name: Run GoReleaser
         uses: goreleaser/goreleaser-action@v2
         with:
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 7e61ea660..b3a69fdea 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -1,88 +1,94 @@
-# This is an example .goreleaser.yml file with some sane defaults.
-# Make sure to check the documentation at http://goreleaser.com
+---
+project_name: permify
+universal_binaries:
+  - replace: true
 builds:
-  - main: "./cmd/permify"
+  -
     env:
       - CGO_ENABLED=0
-    goos:
-      - "linux"
-      - "windows"
-      - "darwin"
     goarch:
-      - "amd64"
-      - "arm64"
-    mod_timestamp: '{{ .CommitTimestamp }}'
+      - amd64
+      - arm64
+    goos:
+      - linux
+      - windows
+      - darwin
     ldflags:
       - "-s -w"
-nfpms:
-  - vendor: "permify inc."
-    homepage: "https://permify.co"
-    maintainer: "permify <help@permify.co>"
-    description: "Permify is an open-source authorization service & policy engine based on Google Zanzibar."
-    license: "GNU General Public License v3.0"
-    formats:
-      - "deb"
-      - "rpm"
-      - "apk"
+    main: ./cmd/permify
+    mod_timestamp: "{{ .CommitTimestamp }}"
 brews:
-  - tap:
-      owner: "permify"
-      name: "homebrew-tap"
-      branch: main
-      token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
-    url_template: "https://github.com/Permify/permify/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
-    download_strategy: "CurlDownloadStrategy"
+  -
+    dependencies:
+      -
+        name: go
+        type: build
+    description: "Permify is an open-source authorization service & policy engine based on Google Zanzibar."
+    download_strategy: CurlDownloadStrategy
     folder: Formula
-    commit_author:
-      name: "permify-bot"
-      email: "hello@permify.co"
     homepage: "https://github.com/Permify/permify"
-    description: "Permify is an open-source authorization service & policy engine based on Google Zanzibar."
     license: "GNU General Public License v3.0"
-    dependencies:
-      - name: "go"
-        type: "build"
-    commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
+    custom_block: |
+      head "https://github.com/Permify/permify.git", :branch => "master"
     install: |
-      if !File.exists? "permify"
-        system "go build ./cmd/permify"
-      end
-      bin.install "permify"
-
+        if !File.exists? "permify"
+          system "go build --ldflags ./cmd/permify"
+        end
+        bin.install "permify"
+    tap:
+      name: homebrew-tap
+      owner: permify
+      token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
+    commit_author:
+      name: permify-bot
+      email: hello@permify.co
+    url_template: "https://github.com/Permify/permify/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
+docker_manifests:
+  -
+    image_templates:
+      - "ghcr.io/permify/permify:v{{ .Version }}-amd64"
+      - "ghcr.io/permify/permify:v{{ .Version }}-arm64"
+    name_template: "ghcr.io/permify/permify:v{{ .Version }}"
+  -
+    image_templates:
+      - "ghcr.io/permify/permify:v{{ .Version }}-amd64"
+      - "ghcr.io/permify/permify:v{{ .Version }}-arm64"
+    name_template: "ghcr.io/permify/permify:latest"
 dockers:
-  # ARM64
-  - image_templates:
-      - ghcr.io/permify/permify:v{{ .Version }}-arm64
-    dockerfile:  Dockerfile.release
+  -
+    build_flag_templates:
+      - "--platform=linux/arm64"
+    dockerfile: Dockerfile.release
     goarch: arm64
+    image_templates:
+      - "ghcr.io/permify/permify:v{{ .Version }}-arm64"
     use: buildx
+  -
     build_flag_templates:
-      - --platform=linux/arm64
-  # AMD64
-  - image_templates:
-      - ghcr.io/permify/permify:v{{ .Version }}-amd64
+      - "--platform=linux/amd64"
     dockerfile: Dockerfile.release
-    use: buildx
     goarch: amd64
-    build_flag_templates:
-      - --platform=linux/amd64
-docker_manifests:
-  # GitHub Registry
-  - name_template: ghcr.io/permify/permify:v{{ .Version }}
-    image_templates:
-      - ghcr.io/permify/permify:v{{ .Version }}-amd64
-      - ghcr.io/permify/permify:v{{ .Version }}-arm64
-  - name_template: ghcr.io/permify/permify:latest
     image_templates:
-      - ghcr.io/permify/permify:v{{ .Version }}-amd64
-      - ghcr.io/permify/permify:v{{ .Version }}-arm64
-checksum:
-  name_template: 'checksums.txt'
+      - "ghcr.io/permify/permify:v{{ .Version }}-amd64"
+    use: buildx
+nfpms:
+  -
+    description: "Permify is an open-source authorization service & policy engine based on Google Zanzibar."
+    formats:
+      - deb
+      - rpm
+      - apk
+    homepage: "https://permify.co"
+    license: "GNU General Public License v3.0"
+    maintainer: "permify <help@permify.co>"
+    vendor: "permify inc."
 snapshot:
   name_template: "{{ .Tag }}-next"
 changelog:
   sort: asc
   filters:
     exclude:
-      - '^docs:'
-      - '^test:'
+      - "^docs:"
+      - "^test:"
+checksum:
+  name_template: checksums.txt
\ No newline at end of file