alpha.yml 9.1 KB

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