build.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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-macos-x86:
  52. runs-on: macos-12
  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 MacOS x86 executable
  65. env:
  66. ARCHFLAGS: "-arch x86_64"
  67. run: |
  68. pyinstaller CursorKeepAlive.spec
  69. - name: Upload MacOS x86 artifact
  70. uses: actions/upload-artifact@v4
  71. with:
  72. name: CursorPro-MacOS-x86
  73. path: dist/CursorPro
  74. build-linux:
  75. runs-on: ubuntu-22.04
  76. steps:
  77. - uses: actions/checkout@v2
  78. - name: Set up Python
  79. uses: actions/setup-python@v2
  80. with:
  81. python-version: '3.x'
  82. - name: Install dependencies
  83. run: |
  84. python -m pip install --upgrade pip
  85. pip install pyinstaller
  86. pip install -r requirements.txt
  87. - name: Build Linux executable
  88. run: |
  89. pyinstaller CursorKeepAlive.spec
  90. - name: Upload Linux artifact
  91. uses: actions/upload-artifact@v4
  92. with:
  93. name: CursorPro-Linux
  94. path: dist/CursorPro
  95. create-release:
  96. needs: [build-windows, build-macos-arm64, build-macos-x86, build-linux]
  97. runs-on: ubuntu-22.04
  98. if: startsWith(github.ref, 'refs/tags/')
  99. steps:
  100. - name: Download all artifacts
  101. uses: actions/download-artifact@v4
  102. with:
  103. path: artifacts
  104. - name: Create release archives
  105. run: |
  106. cd artifacts
  107. zip -r CursorPro-Windows.zip CursorPro-Windows/
  108. zip -r CursorPro-MacOS-ARM64.zip CursorPro-MacOS-ARM64/
  109. zip -r CursorPro-MacOS-x86.zip CursorPro-MacOS-x86/
  110. zip -r CursorPro-Linux.zip CursorPro-Linux/
  111. - name: Create Release
  112. uses: softprops/action-gh-release@v1
  113. with:
  114. files: |
  115. artifacts/CursorPro-Windows.zip
  116. artifacts/CursorPro-MacOS-ARM64.zip
  117. artifacts/CursorPro-MacOS-x86.zip
  118. artifacts/CursorPro-Linux.zip
  119. env:
  120. GITHUB_TOKEN: ${{ secrets.TOKEN }}