build-windows.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: Build Windows Executable
  2. on:
  3. push:
  4. tags:
  5. - 'v*'
  6. workflow_dispatch:
  7. inputs:
  8. version:
  9. description: 'Version tag'
  10. required: false
  11. default: 'latest'
  12. jobs:
  13. build-windows:
  14. runs-on: windows-latest
  15. steps:
  16. - name: Checkout code
  17. uses: actions/checkout@v4
  18. - name: Set up Python
  19. uses: actions/setup-python@v5
  20. with:
  21. python-version: '3.11'
  22. - name: Install dependencies
  23. run: |
  24. python -m pip install --upgrade pip
  25. pip install -r requirements.txt
  26. pip install pyinstaller
  27. - name: Build GUI executable
  28. shell: pwsh
  29. run: |
  30. pyinstaller --clean --noconfirm gui.spec
  31. - name: Build CLI executable
  32. shell: pwsh
  33. run: |
  34. pyinstaller --clean --noconfirm main.spec
  35. - name: Create release package
  36. shell: pwsh
  37. run: |
  38. New-Item -ItemType Directory -Path "release" -Force | Out-Null
  39. New-Item -ItemType Directory -Path "release\data" -Force | Out-Null
  40. Copy-Item dist\searchdomain_gui.exe release\
  41. Copy-Item dist\searchdomain_cli.exe release\
  42. Copy-Item data\a.csv release\data\
  43. Copy-Item data\b.csv release\data\
  44. - name: Upload artifacts
  45. uses: actions/upload-artifact@v4
  46. with:
  47. name: windows-executables
  48. path: release/
  49. - name: Create Release
  50. if: startsWith(github.ref, 'refs/tags/')
  51. uses: softprops/action-gh-release@v1
  52. with:
  53. files: release/*
  54. draft: false
  55. prerelease: false
  56. env:
  57. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}