alpha.yml 9.7 KB

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