build.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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: Upload MacOS Intel artifact
  89. uses: actions/upload-artifact@v4
  90. with:
  91. name: CursorPro-MacOS-Intel
  92. path: dist/CursorPro
  93. create-release:
  94. needs: [build-windows, build-macos-arm64, build-linux, build-macos-intel]
  95. runs-on: ubuntu-22.04
  96. if: startsWith(github.ref, 'refs/tags/')
  97. steps:
  98. - name: Download all artifacts
  99. uses: actions/download-artifact@v4
  100. with:
  101. path: artifacts
  102. - name: Create release archives
  103. run: |
  104. cd artifacts
  105. zip -r CursorPro-Windows.zip CursorPro-Windows/
  106. zip -r CursorPro-MacOS-ARM64.zip CursorPro-MacOS-ARM64/
  107. zip -r CursorPro-Linux.zip CursorPro-Linux/
  108. zip -r CursorPro-MacOS-Intel.zip CursorPro-MacOS-Intel/
  109. - name: Create Release
  110. uses: softprops/action-gh-release@v1
  111. with:
  112. files: |
  113. artifacts/CursorPro-Windows.zip
  114. artifacts/CursorPro-MacOS-ARM64.zip
  115. artifacts/CursorPro-Linux.zip
  116. artifacts/CursorPro-MacOS-Intel.zip
  117. env:
  118. GITHUB_TOKEN: ${{ secrets.TOKEN }}