alpha.yml 9.4 KB

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