alpha.yml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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@1.77.0
  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. NODE_OPTIONS: "--max_old_space_size=4096"
  56. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  57. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  58. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  59. APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
  60. APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  61. APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
  62. with:
  63. tagName: alpha
  64. releaseName: "Clash Verge Rev Alpha"
  65. releaseBody: "More new features are now supported."
  66. releaseDraft: false
  67. prerelease: true
  68. tauriScript: pnpm
  69. args: --target ${{ matrix.target }}
  70. - name: Portable Bundle
  71. if: matrix.os == 'windows-latest'
  72. run: pnpm portable ${{ matrix.target }} --alpha
  73. env:
  74. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  75. alpha-for-linux:
  76. strategy:
  77. fail-fast: false
  78. matrix:
  79. include:
  80. - os: ubuntu-latest
  81. target: x86_64-unknown-linux-gnu
  82. - os: ubuntu-latest
  83. target: i686-unknown-linux-gnu
  84. - os: ubuntu-latest
  85. target: aarch64-unknown-linux-gnu
  86. - os: ubuntu-latest
  87. target: armv7-unknown-linux-gnueabihf
  88. runs-on: ${{ matrix.os }}
  89. steps:
  90. - name: Checkout Repository
  91. uses: actions/checkout@v4
  92. - name: Build for Linux
  93. uses: ./.github/build-for-linux
  94. env:
  95. NODE_OPTIONS: "--max_old_space_size=4096"
  96. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  97. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  98. with:
  99. target: ${{ matrix.target }}
  100. - name: Get Version
  101. run: |
  102. sudo apt-get update
  103. sudo apt-get install jq
  104. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  105. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  106. - name: Upload Release
  107. if: startsWith(matrix.target, 'x86_64')
  108. uses: softprops/action-gh-release@v2
  109. with:
  110. tag_name: alpha
  111. name: "Clash Verge Rev Alpha"
  112. body: "More new features are now supported."
  113. prerelease: true
  114. token: ${{ secrets.GITHUB_TOKEN }}
  115. files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
  116. - name: Upload Release
  117. uses: softprops/action-gh-release@v2
  118. with:
  119. tag_name: alpha
  120. name: "Clash Verge Rev Alpha"
  121. body: "More new features are now supported."
  122. prerelease: true
  123. token: ${{ secrets.GITHUB_TOKEN }}
  124. files: |
  125. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  126. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  127. alpha-for-fixed-webview2:
  128. strategy:
  129. fail-fast: false
  130. matrix:
  131. include:
  132. - os: windows-latest
  133. target: x86_64-pc-windows-msvc
  134. arch: x64
  135. - os: windows-latest
  136. target: i686-pc-windows-msvc
  137. arch: x86
  138. - os: windows-latest
  139. target: aarch64-pc-windows-msvc
  140. arch: arm64
  141. runs-on: ${{ matrix.os }}
  142. steps:
  143. - name: Checkout Repository
  144. uses: actions/checkout@v4
  145. - name: Add Rust Target
  146. run: rustup target add ${{ matrix.target }}
  147. - name: Rust Cache
  148. uses: Swatinem/rust-cache@v2
  149. with:
  150. workspaces: src-tauri
  151. - name: Install Node
  152. uses: actions/setup-node@v4
  153. with:
  154. node-version: "20"
  155. - uses: pnpm/action-setup@v3
  156. name: Install pnpm
  157. with:
  158. version: 9
  159. run_install: false
  160. - name: Pnpm install and check
  161. run: |
  162. pnpm i
  163. pnpm check ${{ matrix.target }}
  164. - name: Download WebView2 Runtime
  165. run: |
  166. 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
  167. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  168. Remove-Item .\src-tauri\tauri.windows.conf.json
  169. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  170. - name: Tauri build
  171. id: build
  172. uses: tauri-apps/tauri-action@v0
  173. env:
  174. NODE_OPTIONS: "--max_old_space_size=4096"
  175. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  176. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  177. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  178. with:
  179. tauriScript: pnpm
  180. args: --target ${{ matrix.target }}
  181. - name: Rename
  182. run: |
  183. 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'
  184. 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'
  185. 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'
  186. - name: Upload Release
  187. uses: softprops/action-gh-release@v2
  188. with:
  189. tag_name: alpha
  190. name: "Clash Verge Rev Alpha"
  191. body: "More new features are now supported."
  192. prerelease: true
  193. token: ${{ secrets.GITHUB_TOKEN }}
  194. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  195. - name: Portable Bundle
  196. run: pnpm portable-fixed-webview2 ${{ matrix.target }} --alpha
  197. env:
  198. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  199. update_tag:
  200. name: Update tag
  201. runs-on: ubuntu-latest
  202. needs: [alpha, alpha-for-linux, alpha-for-fixed-webview2]
  203. steps:
  204. - name: Checkout repository
  205. uses: actions/checkout@v4
  206. - name: Set Env
  207. run: |
  208. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  209. shell: bash
  210. - name: Update Tag
  211. uses: richardsimko/update-tag@v1
  212. with:
  213. tag_name: alpha
  214. env:
  215. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  216. - run: |
  217. cat > release.txt << 'EOF'
  218. ## 我应该下载哪个版本?
  219. ### MacOS (提示文件损坏或开发者无法验证请查看下面FAQ)
  220. - MacOS intel芯片: x64.dmg
  221. - MacOS apple M芯片: aarch64.dmg
  222. ### Linux
  223. - Linux 64位: amd64.AppImage/amd64.deb/amd64.rpm
  224. - Linux 32位: i386.deb/i386.rpm
  225. - Linux arm64架构: arm64.deb/aarch64.rpm
  226. - Linux armv7架构: armhf.deb/armhfp.rpm
  227. ### Windows (Win7 用户请查看下面FAQ中的解决方案)
  228. #### 正常版本(推荐)
  229. - 64位: x64-setup.exe
  230. - 32位: x86-setup.exe
  231. - arm64架构: arm64-setup.exe
  232. #### 便携版(不推荐使用,无法自动更新)
  233. - 64位: x64_portable.zip
  234. - 32位: x86_portable.zip
  235. - arm64架构: arm64_portable.zip
  236. #### 内置Webview2版(体积较大,仅在企业版系统或Win7无法安装webview2时使用)
  237. - 64位: x64_fixed_webview2-setup.exe
  238. - 32位: x86_fixed_webview2-setup.exe
  239. - arm64架构: arm64_fixed_webview2-setup.exe
  240. ### FAQ
  241. - [FAQ](https://clash-verge-rev.github.io/faq/windows.html)
  242. Created at ${{ env.BUILDTIME }}.
  243. EOF
  244. - name: Upload Release
  245. uses: softprops/action-gh-release@v2
  246. with:
  247. tag_name: alpha
  248. name: "Clash Verge Rev Alpha"
  249. body_path: release.txt
  250. prerelease: true
  251. token: ${{ secrets.GITHUB_TOKEN }}
  252. generate_release_notes: true