From c08c611249fbb73b567d55580a97a9610e59d504 Mon Sep 17 00:00:00 2001
From: Chandra Shekhar <67952613+cc-shekher@users.noreply.github.com>
Date: Wed, 4 Dec 2024 10:16:13 +0530
Subject: [PATCH] extend release for other arch (#6)

---
 .github/workflows/release.yml | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f3a60ad..ac7a892 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,36 +3,45 @@ name: Release starchitect provider
 on:
   push:
     tags:
-      - 'v*.*.*' # Trigger this workflow on versioned tags
+      - 'v*.*.*'
 
 jobs:
   release:
     name: Release
     runs-on: ubuntu-latest
+    permissions:
+      contents: write    # Required for creating releases
+    
+    strategy:
+      matrix:
+        goos: [darwin, linux]
+        goarch: [amd64, arm64]
 
     steps:
-      # Step 1: Check out the repository
       - name: Check out the repository
         uses: actions/checkout@v2
 
-      # Step 2: Set up Go
       - name: Set up Go
         uses: actions/setup-go@v2
         with:
           go-version: '1.22'
 
-      # Step 3: Build the binary or artifact
-      - name: Build the binary
-        run: go build -o terraform-provider-starchitect .
-
-      # Step 4: Archive the artifact
-      - name: Archive the binary
-        run: zip release.zip terraform-provider-starchitect
+      - name: Build binary for ${{ matrix.goos }}_${{ matrix.goarch }}
+        env:
+          GOOS: ${{ matrix.goos }}
+          GOARCH: ${{ matrix.goarch }}
+        run: |
+          BINARY_NAME=terraform-provider-starchitect
+          
+          # Build the binary
+          go build -o ${BINARY_NAME} .
+          
+          # Create zip file with OS and architecture in name
+          zip terraform-provider-starchitect_${{ matrix.goos }}_${{ matrix.goarch }}.zip ${BINARY_NAME}
 
-      # Step 5: Create the GitHub release and upload the artifact
-      - name: Create GitHub Release and upload artifact
+      - name: Create GitHub Release and upload artifacts
         uses: softprops/action-gh-release@v1
         with:
-          files: release.zip
+          files: terraform-provider-starchitect_*_*.zip
         env:
           GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}