alpha.yml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. name: Alpha Build
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches: [main]
  6. tags-ignore: [updater, alpha]
  7. permissions: write-all
  8. env:
  9. CARGO_INCREMENTAL: 0
  10. RUST_BACKTRACE: short
  11. jobs:
  12. alpha:
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. include:
  17. - os: windows-latest
  18. target: x86_64-pc-windows-msvc
  19. - os: windows-latest
  20. target: i686-pc-windows-msvc
  21. - os: windows-latest
  22. target: aarch64-pc-windows-msvc
  23. - os: macos-latest
  24. target: aarch64-apple-darwin
  25. - os: macos-latest
  26. target: x86_64-apple-darwin
  27. runs-on: ${{ matrix.os }}
  28. steps:
  29. - name: Checkout Repository
  30. uses: actions/checkout@v4
  31. - name: Install Rust Stable
  32. uses: dtolnay/rust-toolchain@stable
  33. - name: Add Rust Target
  34. run: rustup target add ${{ matrix.target }}
  35. - name: Rust Cache
  36. uses: Swatinem/rust-cache@v2
  37. with:
  38. workspaces: src-tauri
  39. - name: Install Node
  40. uses: actions/setup-node@v4
  41. with:
  42. node-version: "20"
  43. - uses: pnpm/action-setup@v3
  44. name: Install pnpm
  45. with:
  46. version: 9
  47. run_install: false
  48. - name: Pnpm install and check
  49. run: |
  50. pnpm i
  51. pnpm check ${{ matrix.target }}
  52. - name: Tauri build
  53. uses: tauri-apps/tauri-action@v0
  54. env:
  55. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  56. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  57. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  58. with:
  59. tagName: alpha
  60. releaseName: "Clash Verge Rev Alpha"
  61. releaseBody: "More new features are now supported."
  62. releaseDraft: false
  63. prerelease: true
  64. tauriScript: pnpm
  65. args: --target ${{ matrix.target }}
  66. - name: Portable Bundle
  67. if: matrix.os == 'windows-latest'
  68. run: pnpm portable ${{ matrix.target }} --alpha
  69. env:
  70. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  71. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  72. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  73. alpha-for-linux:
  74. strategy:
  75. fail-fast: false
  76. matrix:
  77. include:
  78. - os: ubuntu-latest
  79. target: x86_64-unknown-linux-gnu
  80. - os: ubuntu-latest
  81. target: i686-unknown-linux-gnu
  82. - os: ubuntu-latest
  83. target: aarch64-unknown-linux-gnu
  84. - os: ubuntu-latest
  85. target: armv7-unknown-linux-gnueabihf
  86. runs-on: ${{ matrix.os }}
  87. steps:
  88. - name: Checkout Repository
  89. uses: actions/checkout@v4
  90. - name: Build for Linux
  91. uses: ./.github/build-for-linux
  92. env:
  93. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  94. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  95. with:
  96. target: ${{ matrix.target }}
  97. - name: Get Version
  98. run: |
  99. sudo apt-get update
  100. sudo apt-get install jq
  101. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  102. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  103. - name: Upload Release
  104. if: startsWith(matrix.target, 'x86_64')
  105. uses: softprops/action-gh-release@v1
  106. with:
  107. tag_name: alpha
  108. name: "Clash Verge Rev Alpha"
  109. body: "More new features are now supported."
  110. prerelease: true
  111. token: ${{ secrets.GITHUB_TOKEN }}
  112. files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
  113. - name: Upload Release
  114. uses: softprops/action-gh-release@v2
  115. with:
  116. tag_name: alpha
  117. name: "Clash Verge Rev Alpha"
  118. body: "More new features are now supported."
  119. prerelease: true
  120. token: ${{ secrets.GITHUB_TOKEN }}
  121. files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  122. alpha-for-fixed-webview2:
  123. strategy:
  124. fail-fast: false
  125. matrix:
  126. include:
  127. - os: windows-latest
  128. target: x86_64-pc-windows-msvc
  129. arch: x64
  130. - os: windows-latest
  131. target: i686-pc-windows-msvc
  132. arch: x86
  133. - os: windows-latest
  134. target: aarch64-pc-windows-msvc
  135. arch: arm64
  136. runs-on: ${{ matrix.os }}
  137. steps:
  138. - name: Checkout Repository
  139. uses: actions/checkout@v4
  140. - name: Add Rust Target
  141. run: rustup target add ${{ matrix.target }}
  142. - name: Rust Cache
  143. uses: Swatinem/rust-cache@v2
  144. with:
  145. workspaces: src-tauri
  146. - name: Install Node
  147. uses: actions/setup-node@v4
  148. with:
  149. node-version: "20"
  150. - uses: pnpm/action-setup@v3
  151. name: Install pnpm
  152. with:
  153. version: 9
  154. run_install: false
  155. - name: Pnpm install and check
  156. run: |
  157. pnpm i
  158. pnpm check ${{ matrix.target }}
  159. - name: Download WebView2 Runtime
  160. run: |
  161. invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/109.0.1518.78/Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab
  162. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  163. Remove-Item .\src-tauri\tauri.windows.conf.json
  164. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  165. - name: Tauri build
  166. id: build
  167. uses: tauri-apps/tauri-action@v0
  168. env:
  169. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  170. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  171. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  172. with:
  173. tauriScript: pnpm
  174. args: --target ${{ matrix.target }}
  175. - name: Rename
  176. run: |
  177. Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\Clash Verge_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.exe' 'Clash Verge_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.exe'
  178. Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\Clash Verge_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.nsis.zip' 'Clash Verge_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.nsis.zip'
  179. Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\Clash Verge_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.nsis.zip.sig' 'Clash Verge_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.nsis.zip.sig'
  180. - name: Upload Release
  181. uses: softprops/action-gh-release@v2
  182. with:
  183. tag_name: alpha
  184. name: "Clash Verge Rev Alpha"
  185. body: "More new features are now supported."
  186. prerelease: true
  187. token: ${{ secrets.GITHUB_TOKEN }}
  188. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  189. update_tag:
  190. name: Update tag
  191. runs-on: ubuntu-latest
  192. needs: [alpha, alpha-for-linux, alpha-for-fixed-webview2]
  193. steps:
  194. - name: Checkout repository
  195. uses: actions/checkout@v4
  196. - name: Set Env
  197. run: |
  198. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  199. shell: bash
  200. - name: Update Tag
  201. uses: richardsimko/update-tag@v1
  202. with:
  203. tag_name: alpha
  204. env:
  205. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  206. - run: |
  207. cat > release.txt << 'EOF'
  208. ### 我应该下载哪个版本?
  209. - Windows 64位: x64-setup.exe (不支持win7)
  210. - Windows 32位: x86-setup.exe (不支持win7)
  211. - Windows arm64架构: arm64-setup.exe
  212. - MacOS intel芯片: x64.dmg
  213. - MacOS apple M芯片: aarch64.dmg (提示文件损坏看下面FAQ)
  214. - Linux 64位: amd64.AppImage/amd64.deb
  215. - Linux 32位: i386.deb
  216. - Linux arm64架构: arm64.deb
  217. - Linux armv7架构: armhf.deb
  218. - Windows 便携板 64位: x64_portable.zip (不推荐使用,无法自动更新)
  219. - Windows 便携板 32位: x86_portable.zip (不推荐使用,无法自动更新)
  220. - Windows 便携板 arm64架构: arm64_portable.zip (不推荐使用,无法自动更新)
  221. ### FAQ
  222. - [FAQ](https://clash-verge-rev.github.io/faq/install.html)
  223. Created at ${{ env.BUILDTIME }}.
  224. EOF
  225. - name: Upload Release
  226. uses: softprops/action-gh-release@v2
  227. with:
  228. tag_name: alpha
  229. name: "Clash Verge Rev Alpha"
  230. body_path: release.txt
  231. prerelease: true
  232. token: ${{ secrets.GITHUB_TOKEN }}
  233. generate_release_notes: true