build.yml 3.7 KB

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