alpha.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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. uses: softprops/action-gh-release@v2
  108. with:
  109. tag_name: alpha
  110. name: "Clash Verge Rev Alpha"
  111. body: "More new features are now supported."
  112. prerelease: true
  113. token: ${{ secrets.GITHUB_TOKEN }}
  114. files: |
  115. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  116. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  117. alpha-for-fixed-webview2:
  118. strategy:
  119. fail-fast: false
  120. matrix:
  121. include:
  122. - os: windows-latest
  123. target: x86_64-pc-windows-msvc
  124. arch: x64
  125. - os: windows-latest
  126. target: i686-pc-windows-msvc
  127. arch: x86
  128. - os: windows-latest
  129. target: aarch64-pc-windows-msvc
  130. arch: arm64
  131. runs-on: ${{ matrix.os }}
  132. steps:
  133. - name: Checkout Repository
  134. uses: actions/checkout@v4
  135. - name: Add Rust Target
  136. run: rustup target add ${{ matrix.target }}
  137. - name: Rust Cache
  138. uses: Swatinem/rust-cache@v2
  139. with:
  140. workspaces: src-tauri
  141. - name: Install Node
  142. uses: actions/setup-node@v4
  143. with:
  144. node-version: "20"
  145. - uses: pnpm/action-setup@v3
  146. name: Install pnpm
  147. with:
  148. version: 9
  149. run_install: false
  150. - name: Pnpm install and check
  151. run: |
  152. pnpm i
  153. pnpm check ${{ matrix.target }}
  154. - name: Download WebView2 Runtime
  155. run: |
  156. 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
  157. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  158. Remove-Item .\src-tauri\tauri.windows.conf.json
  159. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  160. - name: Tauri build
  161. id: build
  162. uses: tauri-apps/tauri-action@v0
  163. env:
  164. NODE_OPTIONS: "--max_old_space_size=4096"
  165. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  166. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  167. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  168. with:
  169. tauriScript: pnpm
  170. args: --target ${{ matrix.target }}
  171. - name: Rename
  172. run: |
  173. 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'
  174. 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'
  175. 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'
  176. - name: Upload Release
  177. uses: softprops/action-gh-release@v2
  178. with:
  179. tag_name: alpha
  180. name: "Clash Verge Rev Alpha"
  181. body: "More new features are now supported."
  182. prerelease: true
  183. token: ${{ secrets.GITHUB_TOKEN }}
  184. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  185. - name: Portable Bundle
  186. run: pnpm portable-fixed-webview2 ${{ matrix.target }} --alpha
  187. env:
  188. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  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. ### MacOS (提示文件损坏或开发者无法验证请查看下面FAQ)
  210. - MacOS intel芯片: x64.dmg
  211. - MacOS apple M芯片: aarch64.dmg
  212. ### Linux
  213. - Linux 64位: amd64.AppImage/amd64.deb/amd64.rpm
  214. - Linux 32位: i386.deb/i386.rpm
  215. - Linux arm64架构: arm64.deb/aarch64.rpm
  216. - Linux armv7架构: armhf.deb/armhfp.rpm
  217. ### Windows (Win7 用户请查看下面FAQ中的解决方案)
  218. #### 正常版本(推荐)
  219. - 64位: x64-setup.exe
  220. - 32位: x86-setup.exe
  221. - arm64架构: arm64-setup.exe
  222. #### 便携版(不推荐使用,无法自动更新)
  223. - 64位: x64_portable.zip
  224. - 32位: x86_portable.zip
  225. - arm64架构: arm64_portable.zip
  226. #### 内置Webview2版(体积较大,仅在企业版系统或Win7无法安装webview2时使用)
  227. - 64位: x64_fixed_webview2-setup.exe
  228. - 32位: x86_fixed_webview2-setup.exe
  229. - arm64架构: arm64_fixed_webview2-setup.exe
  230. ### FAQ
  231. - [FAQ](https://clash-verge-rev.github.io/faq/windows.html)
  232. Created at ${{ env.BUILDTIME }}.
  233. EOF
  234. - name: Upload Release
  235. uses: softprops/action-gh-release@v2
  236. with:
  237. tag_name: alpha
  238. name: "Clash Verge Rev Alpha"
  239. body_path: release.txt
  240. prerelease: true
  241. token: ${{ secrets.GITHUB_TOKEN }}
  242. generate_release_notes: true