build.yml 2.8 KB

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