alpha.yml 9.5 KB

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