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