build.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. name: Build Executables
  2. on:
  3. push:
  4. tags:
  5. - 'v*' # 仍然保留标签触发条件,匹配 v1.0.0 这样的标签
  6. workflow_dispatch: # 允许手动触发构建
  7. jobs:
  8. build-windows:
  9. runs-on: windows-latest
  10. steps:
  11. - uses: actions/checkout@v2
  12. - name: Set up Python
  13. uses: actions/setup-python@v2
  14. with:
  15. python-version: '3.x'
  16. - name: Install dependencies
  17. run: |
  18. python -m pip install --upgrade pip
  19. pip install pyinstaller
  20. pip install -r requirements.txt
  21. - name: Build EXE
  22. run: |
  23. pyinstaller CursorKeepAlive.spec
  24. - name: Upload Windows artifact
  25. uses: actions/upload-artifact@v4
  26. with:
  27. name: CursorPro-Windows
  28. path: dist/CursorPro.exe
  29. build-macos-arm64:
  30. runs-on: macos-latest
  31. steps:
  32. - uses: actions/checkout@v2
  33. - name: Set up Python
  34. uses: actions/setup-python@v2
  35. with:
  36. python-version: '3.x'
  37. - name: Install dependencies
  38. run: |
  39. python -m pip install --upgrade pip
  40. pip install pyinstaller
  41. pip install -r requirements.txt
  42. - name: Build MacOS ARM executable
  43. run: |
  44. pyinstaller CursorKeepAlive.spec
  45. - name: Upload MacOS ARM artifact
  46. uses: actions/upload-artifact@v4
  47. with:
  48. name: CursorPro-MacOS-ARM64
  49. path: dist/CursorPro
  50. build-linux:
  51. runs-on: ubuntu-22.04
  52. steps:
  53. - uses: actions/checkout@v2
  54. - name: Set up Python
  55. uses: actions/setup-python@v2
  56. with:
  57. python-version: '3.x'
  58. - name: Install dependencies
  59. run: |
  60. python -m pip install --upgrade pip
  61. pip install pyinstaller
  62. pip install -r requirements.txt
  63. - name: Build Linux executable
  64. run: |
  65. pyinstaller CursorKeepAlive.spec
  66. - name: Upload Linux artifact
  67. uses: actions/upload-artifact@v4
  68. with:
  69. name: CursorPro-Linux
  70. path: dist/CursorPro
  71. build-macos-intel:
  72. runs-on: macos-latest
  73. steps:
  74. - uses: actions/checkout@v2
  75. - name: Set up Python
  76. uses: actions/setup-python@v2
  77. with:
  78. python-version: '3.x'
  79. - name: Install dependencies
  80. run: |
  81. arch -x86_64 pip3 install --upgrade pip
  82. arch -x86_64 pip3 install pyinstaller
  83. arch -x86_64 pip3 install -r requirements.txt
  84. - name: Build MacOS Intel executable
  85. env:
  86. TARGET_ARCH: 'x86_64'
  87. run: |
  88. arch -x86_64 python3 -m PyInstaller CursorKeepAlive.spec
  89. - name: Upload MacOS Intel artifact
  90. uses: actions/upload-artifact@v4
  91. with:
  92. name: CursorPro-MacOS-Intel
  93. path: dist/CursorPro
  94. create-release:
  95. needs: [build-windows, build-macos-arm64, build-linux, build-macos-intel]
  96. runs-on: ubuntu-22.04
  97. if: startsWith(github.ref, 'refs/tags/')
  98. steps:
  99. - name: Download all artifacts
  100. uses: actions/download-artifact@v4
  101. with:
  102. path: artifacts
  103. - name: Create release archives
  104. run: |
  105. cd artifacts
  106. zip -r CursorPro-Windows.zip CursorPro-Windows/
  107. zip -r CursorPro-MacOS-ARM64.zip CursorPro-MacOS-ARM64/
  108. zip -r CursorPro-Linux.zip CursorPro-Linux/
  109. zip -r CursorPro-MacOS-Intel.zip CursorPro-MacOS-Intel/
  110. - name: Create Release
  111. uses: softprops/action-gh-release@v1
  112. with:
  113. files: |
  114. artifacts/CursorPro-Windows.zip
  115. artifacts/CursorPro-MacOS-ARM64.zip
  116. artifacts/CursorPro-Linux.zip
  117. artifacts/CursorPro-MacOS-Intel.zip
  118. env:
  119. GITHUB_TOKEN: ${{ secrets.TOKEN }}