build-windows.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. permissions:
  16. actions: write
  17. steps:
  18. - name: Checkout code
  19. uses: actions/checkout@v4
  20. - name: Set up Python
  21. uses: actions/setup-python@v5
  22. with:
  23. python-version: '3.11'
  24. - name: Install dependencies
  25. run: |
  26. python -m pip install --upgrade pip
  27. pip install -r requirements.txt
  28. pip install pyinstaller
  29. - name: Build GUI executable
  30. shell: pwsh
  31. run: |
  32. pyinstaller --clean --noconfirm gui.spec
  33. - name: Build CLI executable
  34. shell: pwsh
  35. run: |
  36. pyinstaller --clean --noconfirm main.spec
  37. - name: Create release package
  38. shell: pwsh
  39. run: |
  40. New-Item -ItemType Directory -Path "release" -Force | Out-Null
  41. New-Item -ItemType Directory -Path "release\data" -Force | Out-Null
  42. Copy-Item dist\searchdomain_gui.exe release\
  43. Copy-Item dist\searchdomain_cli.exe release\
  44. Copy-Item data\a.csv release\data\
  45. Copy-Item data\b.csv release\data\
  46. - name: Upload artifacts
  47. uses: actions/upload-artifact@v4
  48. with:
  49. name: windows-executables
  50. path: release/
  51. - name: Create Release
  52. if: startsWith(github.ref, 'refs/tags/')
  53. uses: softprops/action-gh-release@v1
  54. with:
  55. files: release/*
  56. draft: false
  57. prerelease: false
  58. env:
  59. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  60. - name: Remove old artifacts
  61. uses: c-hive/gha-remove-artifacts@v1
  62. with:
  63. age: '3 days' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js
  64. # Optional inputs
  65. # skip-tags: true
  66. skip-recent: 1