feat: fix binary names (#11)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e7c3cd7..3edab7d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,94 +1,105 @@
-name: Release  
-  
-on:  
-  push:  
-    branches: [master]
-  pull_request:  
+name: Release    
+    
+on:    
+  push:    
     branches: [master]  
-  
-jobs:  
-  test:  
-    runs-on: ubuntu-latest  
-    strategy:  
-      matrix:  
-        python-version: ["3.9", "3.10", "3.11", "3.12"]  
+  pull_request:    
+    branches: [master] 
+    
+jobs:    
+  test:    
+    runs-on: ubuntu-latest    
+    strategy:    
+      matrix:    
+        python-version: ["3.9", "3.10", "3.11", "3.12"]    
+        
+    steps:    
+    - uses: actions/checkout@v4    
+    - name: Set up Python ${{ matrix.python-version }}    
+      uses: actions/setup-python@v4    
+      with:    
+        python-version: ${{ matrix.python-version }}    
+        
+    - name: Install dependencies    
+      run: |    
+        python -m pip install --upgrade pip    
+        pip install -r requirements.txt    
+        pip install pytest  
+        
+    - name: Run tests  
+      run: pytest tests/ -v  
+    
+  build-binaries:    
+    needs: test    
+    runs-on: ${{ matrix.os }}    
+    strategy:    
+      matrix:    
+        include:  
+          - os: ubuntu-latest  
+            platform: linux  
+          - os: windows-latest  
+            platform: windows  
+          - os: macos-latest  
+            platform: darwin  
       
-    steps:  
-    - uses: actions/checkout@v4  
-    - name: Set up Python ${{ matrix.python-version }}  
-      uses: actions/setup-python@v4  
-      with:  
-        python-version: ${{ matrix.python-version }}  
-      
-    - name: Install dependencies  
-      run: |  
-        python -m pip install --upgrade pip  
-        pip install -r requirements.txt  
-  
-  build-binaries:  
-    needs: test  
-    runs-on: ${{ matrix.os }}  
-    strategy:  
-      matrix:  
-        os: [ubuntu-latest, windows-latest, macos-latest]  
-      
-    steps:  
-    - uses: actions/checkout@v4  
-    - name: Set up Python  
-      uses: actions/setup-python@v4  
-      with:  
-        python-version: 3.11  
-      
-    - name: Install dependencies  
-      run: |  
-        python -m pip install --upgrade pip  
-        pip install -r requirements.txt  
-        pip install pyinstaller  
-      
-    - name: Build binary  
-      run: python scripts/build_binaries.py  
-      
-    - name: Upload artifacts  
-      uses: actions/upload-artifact@v4  
-      with:  
-        name: binaries-${{ matrix.os }}  
-        path: dist/casbin-python-cli-*  
-  
-  release:  
-    needs: [test, build-binaries]  
-    runs-on: ubuntu-latest  
-    if: github.ref == 'refs/heads/master' || github.event_name == 'pull_request'
-      
-    steps:  
-    - uses: actions/checkout@v4  
-      with:  
-        fetch-depth: 0  
-        token: ${{ secrets.GITHUB_TOKEN }}  
-      
-    - name: Set up Python  
-      uses: actions/setup-python@v4  
-      with:  
-        python-version: 3.11  
-      
-    - name: Install dependencies  
-      run: |  
-        python -m pip install --upgrade pip  
-        pip install -r requirements.txt  
-        pip install wheel twine  
-        npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/github  
-      
-    - name: Download all artifacts  
-      uses: actions/download-artifact@v4  
-      with:  
-        path: artifacts  
-      
-    - name: Move binaries to dist  
-      run: |  
-        mkdir -p dist  
-        find artifacts -name "casbin-python-cli-*" -exec cp {} dist/ \;  
-      
-    - name: Semantic Release  
-      env:  
-        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        #PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}  
+    steps:    
+    - uses: actions/checkout@v4    
+    - name: Set up Python    
+      uses: actions/setup-python@v4    
+      with:    
+        python-version: 3.11    
+        
+    - name: Install dependencies    
+      run: |    
+        python -m pip install --upgrade pip    
+        pip install -r requirements.txt    
+        pip install pyinstaller    
+        
+    - name: Build binary    
+      run: python scripts/build_binaries.py --platform ${{ matrix.platform }}  
+        
+    - name: Upload artifacts    
+      uses: actions/upload-artifact@v4    
+      with:    
+        name: binaries-${{ matrix.platform }}    
+        path: dist/casbin-python-cli-${{ matrix.platform }}-*  
+    
+  release:    
+    needs: [test, build-binaries]    
+    runs-on: ubuntu-latest    
+    if: github.ref == 'refs/heads/master' || github.event_name == 'pull_request' 
+        
+    steps:    
+    - uses: actions/checkout@v4    
+      with:    
+        fetch-depth: 0    
+        token: ${{ secrets.GITHUB_TOKEN }}    
+        
+    - name: Set up Python    
+      uses: actions/setup-python@v4    
+      with:    
+        python-version: 3.11    
+        
+    - name: Install dependencies    
+      run: |    
+        python -m pip install --upgrade pip    
+        pip install -r requirements.txt    
+        pip install wheel twine    
+        npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/github    
+        
+    - name: Download all artifacts    
+      uses: actions/download-artifact@v4    
+      with:    
+        path: artifacts    
+        
+    - name: Move binaries to dist    
+      run: |    
+        mkdir -p dist    
+        find artifacts -name "casbin-python-cli-*" -type f -exec cp {} dist/ \;  
+        ls -la dist/  
+        
+    - name: Semantic Release    
+      env:    
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  
+        #PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}    
       run: npx semantic-release
\ No newline at end of file
diff --git a/.releaserc.json b/.releaserc.json
index 6ba8df1..ddaed9d 100644
--- a/.releaserc.json
+++ b/.releaserc.json
@@ -1,6 +1,6 @@
 {  
-  "branches": ["master"],
-  "repositoryUrl":"https://github.com/casbin/casbin-python-cli",
+  "branches": ["master"],  
+  "repositoryUrl": "https://github.com/casbin/casbin-python-cli",  
   "plugins": [  
     "@semantic-release/commit-analyzer",  
     "@semantic-release/release-notes-generator",  
@@ -13,27 +13,19 @@
     [  
       "@semantic-release/exec",  
       {  
-        "prepareCmd": "python scripts/update_version.py ${nextRelease.version}"
+        "prepareCmd": "python scripts/update_version.py ${nextRelease.version}"  
       }  
     ],  
     [  
       "@semantic-release/github",  
       {  
         "assets": [  
-          {  
-            "path": "dist/*.whl",  
-            "label": "Python Wheel"  
-          },  
-          {  
-            "path": "dist/*.tar.gz",  
-            "label": "Source Distribution"  
-          },  
-          {  
-            "path": "dist/casbin-python-cli-*",
-            "name": "casbin-python-cli-${nextRelease.version}",  
-            "label": "casbin-python-cli (${nextRelease.version})"
-          }  
-        ]  
+          "dist/casbin-python-cli-linux-*",  
+          "dist/casbin-python-cli-darwin-*",  
+          "dist/casbin-python-cli-windows-*"  
+        ],  
+        "successComment": false,  
+        "failComment": false  
       }  
     ]  
   ]  
diff --git a/scripts/build_binaries.py b/scripts/build_binaries.py
index 803a789..641d4ba 100644
--- a/scripts/build_binaries.py
+++ b/scripts/build_binaries.py
@@ -1,57 +1,88 @@
-# Copyright 2025 The casbin Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os  
-import sys  
-import subprocess  
-import platform  
+# Copyright 2025 The casbin Authors. All Rights Reserved.  
+#  
+# Licensed under the Apache License, Version 2.0 (the "License");  
+# you may not use this file except in compliance with the License.  
+# You may obtain a copy of the License at  
+#  
+#      http://www.apache.org/licenses/LICENSE-2.0  
+#  
+# Unless required by applicable law or agreed to in writing, software  
+# distributed under the License is distributed on an "AS IS" BASIS,  
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
+# See the License for the specific language governing permissions and  
+# limitations under the License.  
   
-def build_binary():  
+import os    
+import sys    
+import subprocess    
+import platform  
+import argparse  
+    
+def build_binary():    
     """Build standalone binary using PyInstaller"""  
       
-    # Install PyInstaller if not present  
-    subprocess.run([sys.executable, "-m", "pip", "install", "pyinstaller"], check=True)  
+    # Parse command line arguments  
+    parser = argparse.ArgumentParser()  
+    parser.add_argument('--platform', help='Target platform (linux, darwin, windows)')  
+    args = parser.parse_args()  
       
-    # Get platform info  
+    # Install PyInstaller if not present    
+    subprocess.run([sys.executable, "-m", "pip", "install", "pyinstaller"], check=True)    
+      
+    # Get platform and architecture info  
     system = platform.system().lower()  
     arch = platform.machine().lower()  
+        
+    arch_mapping = {  
+        'x86_64': 'x86_64',  
+        'amd64': 'x86_64',   
+        'arm64': 'arm64',  
+        'aarch64': 'arm64',  
+        'i386': '386',  
+        'i686': '386'  
+    }  
       
-    # Build binary  
-    binary_name = f"casbin-python-cli-{system}-{arch}"  
-    if system == "windows":  
-        binary_name += ".exe"  
+    normalized_arch = arch_mapping.get(arch, arch)  
+       
+    if args.platform:  
+        target_platform = args.platform  
+    else:  
+        # Fallback to auto-detection  
+        if system == 'darwin':  
+            target_platform = 'darwin'  
+        elif system == 'linux':  
+            target_platform = 'linux'  
+        elif system == 'windows':  
+            target_platform = 'windows'  
+        else:  
+            target_platform = system  
       
-    cmd = [  
-    "pyinstaller",  
-    "--onefile",  
-    "--name", binary_name,  
-    "--console",  
-    "--paths", ".",  
-    "--hidden-import", "casbin_cli",  
-    "--hidden-import", "casbin",  
-    "--hidden-import", "casbin_cli.client",  
-    "--hidden-import", "casbin_cli.command_executor",   
-    "--hidden-import", "casbin_cli.enforcer_factory",  
-    "--hidden-import", "casbin_cli.response",  
-    "--hidden-import", "casbin_cli.utils",  
-    "--collect-all", "casbin", 
-    "casbin_cli/client.py"  
-] 
-      
-    subprocess.run(cmd, check=True)  
-      
-    print(f"Binary built successfully: dist/{binary_name}")  
-  
-if __name__ == "__main__":  
+    # Build binary name  
+    binary_name = f"casbin-python-cli-{target_platform}-{normalized_arch}"  
+    executable_name = binary_name  
+    if target_platform == "windows":    
+        executable_name += ".exe"  
+        
+    cmd = [    
+        "pyinstaller",    
+        "--onefile",    
+        "--name", binary_name,
+        "--console",    
+        "--paths", ".",    
+        "--hidden-import", "casbin_cli",    
+        "--hidden-import", "casbin",    
+        "--hidden-import", "casbin_cli.client",    
+        "--hidden-import", "casbin_cli.command_executor",     
+        "--hidden-import", "casbin_cli.enforcer_factory",    
+        "--hidden-import", "casbin_cli.response",    
+        "--hidden-import", "casbin_cli.utils",    
+        "--collect-all", "casbin",   
+        "casbin_cli/client.py"    
+    ]   
+        
+    subprocess.run(cmd, check=True)    
+        
+    print(f"Binary built successfully: dist/{executable_name}")    
+    
+if __name__ == "__main__":    
     build_binary()
\ No newline at end of file