alpha.yml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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. run_install: false
  49. - name: Pnpm install and check
  50. run: |
  51. pnpm i
  52. pnpm check ${{ matrix.target }}
  53. - name: Tauri build
  54. uses: tauri-apps/tauri-action@v0
  55. env:
  56. NODE_OPTIONS: "--max_old_space_size=4096"
  57. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  58. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  59. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  60. APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
  61. APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  62. APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
  63. with:
  64. tagName: alpha
  65. releaseName: "Clash Verge Rev Alpha"
  66. releaseBody: "More new features are now supported."
  67. releaseDraft: false
  68. prerelease: true
  69. tauriScript: cargo tauri
  70. args: --target ${{ matrix.target }}
  71. - name: Portable Bundle
  72. if: matrix.os == 'windows-latest'
  73. run: pnpm portable ${{ matrix.target }} --alpha
  74. env:
  75. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  76. alpha-for-linux:
  77. strategy:
  78. fail-fast: false
  79. matrix:
  80. include:
  81. - os: ubuntu-latest
  82. target: x86_64-unknown-linux-gnu
  83. - os: ubuntu-latest
  84. target: i686-unknown-linux-gnu
  85. - os: ubuntu-latest
  86. target: aarch64-unknown-linux-gnu
  87. - os: ubuntu-latest
  88. target: armv7-unknown-linux-gnueabihf
  89. runs-on: ${{ matrix.os }}
  90. steps:
  91. - name: Checkout Repository
  92. uses: actions/checkout@v4
  93. - name: Build for Linux
  94. uses: ./.github/build-for-linux
  95. env:
  96. NODE_OPTIONS: "--max_old_space_size=4096"
  97. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  98. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  99. with:
  100. target: ${{ matrix.target }}
  101. - name: Get Version
  102. run: |
  103. sudo apt-get update
  104. sudo apt-get install jq
  105. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  106. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  107. - name: Upload Release
  108. uses: softprops/action-gh-release@v2
  109. with:
  110. tag_name: alpha
  111. name: "Clash Verge Rev Alpha"
  112. body: "More new features are now supported."
  113. prerelease: true
  114. token: ${{ secrets.GITHUB_TOKEN }}
  115. files: |
  116. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  117. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  118. alpha-for-fixed-webview2:
  119. strategy:
  120. fail-fast: false
  121. matrix:
  122. include:
  123. - os: windows-latest
  124. target: x86_64-pc-windows-msvc
  125. arch: x64
  126. - os: windows-latest
  127. target: i686-pc-windows-msvc
  128. arch: x86
  129. - os: windows-latest
  130. target: aarch64-pc-windows-msvc
  131. arch: arm64
  132. runs-on: ${{ matrix.os }}
  133. steps:
  134. - name: Checkout Repository
  135. uses: actions/checkout@v4
  136. - name: Add Rust Target
  137. run: rustup target add ${{ matrix.target }}
  138. - name: Rust Cache
  139. uses: Swatinem/rust-cache@v2
  140. with:
  141. workspaces: src-tauri
  142. - name: Install Tauri CLI
  143. run: cargo install --git https://github.com/tauri-apps/tauri --branch 1.x tauri-cli
  144. - name: Install Node
  145. uses: actions/setup-node@v4
  146. with:
  147. node-version: "20"
  148. - uses: pnpm/action-setup@v4
  149. name: Install pnpm
  150. with:
  151. run_install: false
  152. - name: Pnpm install and check
  153. run: |
  154. pnpm i
  155. pnpm check ${{ matrix.target }}
  156. - name: Download WebView2 Runtime
  157. run: |
  158. 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
  159. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  160. Remove-Item .\src-tauri\tauri.windows.conf.json
  161. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  162. - name: Tauri build
  163. id: build
  164. uses: tauri-apps/tauri-action@v0
  165. env:
  166. NODE_OPTIONS: "--max_old_space_size=4096"
  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: cargo tauri
  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/amd64.rpm
  216. - Linux 32位: i386.deb/i386.rpm
  217. - Linux arm64架构: arm64.deb/aarch64.rpm
  218. - Linux armv7架构: armhf.deb/armhfp.rpm
  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