alpha.yml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. concurrency:
  12. # only allow per workflow per commit (and not pr) to run at a time
  13. group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}"
  14. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
  15. jobs:
  16. alpha:
  17. strategy:
  18. fail-fast: false
  19. matrix:
  20. include:
  21. - os: windows-latest
  22. target: x86_64-pc-windows-msvc
  23. - os: windows-latest
  24. target: i686-pc-windows-msvc
  25. - os: windows-latest
  26. target: aarch64-pc-windows-msvc
  27. - os: macos-latest
  28. target: aarch64-apple-darwin
  29. - os: macos-latest
  30. target: x86_64-apple-darwin
  31. runs-on: ${{ matrix.os }}
  32. steps:
  33. - name: Checkout Repository
  34. uses: actions/checkout@v4
  35. - name: Install Rust Stable
  36. uses: dtolnay/rust-toolchain@1.77.0
  37. - name: Add Rust Target
  38. run: rustup target add ${{ matrix.target }}
  39. - name: Rust Cache
  40. uses: Swatinem/rust-cache@v2
  41. with:
  42. workspaces: src-tauri
  43. cache-all-crates: true
  44. cache-on-failure: true
  45. - name: Install Node
  46. uses: actions/setup-node@v4
  47. with:
  48. node-version: "20"
  49. - uses: pnpm/action-setup@v4
  50. name: Install pnpm
  51. with:
  52. run_install: false
  53. - name: Pnpm install and check
  54. run: |
  55. pnpm i
  56. pnpm check ${{ matrix.target }}
  57. - name: Tauri build
  58. uses: tauri-apps/tauri-action@v0
  59. env:
  60. NODE_OPTIONS: "--max_old_space_size=4096"
  61. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  63. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  64. APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
  65. APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  66. APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
  67. APPLE_ID: ${{ secrets.APPLE_ID }}
  68. APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
  69. APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  70. with:
  71. tagName: alpha
  72. releaseName: "Clash Verge Rev Alpha"
  73. releaseBody: "More new features are now supported."
  74. releaseDraft: false
  75. prerelease: true
  76. tauriScript: pnpm
  77. args: --target ${{ matrix.target }}
  78. - name: Portable Bundle
  79. if: matrix.os == 'windows-latest'
  80. run: pnpm portable ${{ matrix.target }} --alpha
  81. env:
  82. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  83. alpha-for-linux:
  84. strategy:
  85. fail-fast: false
  86. matrix:
  87. include:
  88. - os: ubuntu-latest
  89. target: x86_64-unknown-linux-gnu
  90. - os: ubuntu-latest
  91. target: i686-unknown-linux-gnu
  92. - os: ubuntu-latest
  93. target: aarch64-unknown-linux-gnu
  94. - os: ubuntu-latest
  95. target: armv7-unknown-linux-gnueabihf
  96. runs-on: ${{ matrix.os }}
  97. steps:
  98. - name: Checkout Repository
  99. uses: actions/checkout@v4
  100. - name: Build for Linux
  101. uses: ./.github/build-for-linux
  102. env:
  103. NODE_OPTIONS: "--max_old_space_size=4096"
  104. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  105. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  106. with:
  107. target: ${{ matrix.target }}
  108. - name: Get Version
  109. run: |
  110. sudo apt-get update
  111. sudo apt-get install jq
  112. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  113. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  114. - name: Upload Release
  115. uses: softprops/action-gh-release@v2
  116. with:
  117. tag_name: alpha
  118. name: "Clash Verge Rev Alpha"
  119. body: "More new features are now supported."
  120. prerelease: true
  121. token: ${{ secrets.GITHUB_TOKEN }}
  122. files: |
  123. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  124. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  125. alpha-for-fixed-webview2:
  126. strategy:
  127. fail-fast: false
  128. matrix:
  129. include:
  130. - os: windows-latest
  131. target: x86_64-pc-windows-msvc
  132. arch: x64
  133. - os: windows-latest
  134. target: i686-pc-windows-msvc
  135. arch: x86
  136. - os: windows-latest
  137. target: aarch64-pc-windows-msvc
  138. arch: arm64
  139. runs-on: ${{ matrix.os }}
  140. steps:
  141. - name: Checkout Repository
  142. uses: actions/checkout@v4
  143. - name: Add Rust Target
  144. run: rustup target add ${{ matrix.target }}
  145. - name: Rust Cache
  146. uses: Swatinem/rust-cache@v2
  147. with:
  148. workspaces: src-tauri
  149. cache-all-crates: true
  150. cache-on-failure: true
  151. - name: Install Node
  152. uses: actions/setup-node@v4
  153. with:
  154. node-version: "20"
  155. - uses: pnpm/action-setup@v4
  156. name: Install pnpm
  157. with:
  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: pnpm
  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.deb/amd64.rpm
  223. - Linux 32位: i386.deb/i386.rpm
  224. - Linux arm64架构: arm64.deb/aarch64.rpm
  225. - Linux armv7架构: armhf.deb/armhfp.rpm
  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