alpha.yml 10 KB

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