alpha.yml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. - name: Install Tauri CLI
  156. run: cargo install --git https://github.com/tauri-apps/tauri --branch 1.x tauri-cli
  157. - name: Install Node
  158. uses: actions/setup-node@v4
  159. with:
  160. node-version: "20"
  161. - uses: pnpm/action-setup@v4
  162. name: Install pnpm
  163. with:
  164. run_install: false
  165. - name: Pnpm install and check
  166. run: |
  167. pnpm i
  168. pnpm check ${{ matrix.target }}
  169. - name: Download WebView2 Runtime
  170. run: |
  171. 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
  172. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  173. Remove-Item .\src-tauri\tauri.windows.conf.json
  174. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  175. - name: Tauri build
  176. id: build
  177. uses: tauri-apps/tauri-action@v0
  178. env:
  179. NODE_OPTIONS: "--max_old_space_size=4096"
  180. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  181. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  182. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  183. with:
  184. tauriScript: cargo tauri
  185. args: --target ${{ matrix.target }}
  186. - name: Rename
  187. run: |
  188. 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'
  189. 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'
  190. 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'
  191. - name: Upload Release
  192. uses: softprops/action-gh-release@v2
  193. with:
  194. tag_name: alpha
  195. name: "Clash Verge Rev Alpha"
  196. body: "More new features are now supported."
  197. prerelease: true
  198. token: ${{ secrets.GITHUB_TOKEN }}
  199. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  200. - name: Portable Bundle
  201. run: pnpm portable-fixed-webview2 ${{ matrix.target }} --alpha
  202. env:
  203. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  204. update_tag:
  205. name: Update tag
  206. runs-on: ubuntu-latest
  207. needs: [alpha, alpha-for-linux, alpha-for-fixed-webview2]
  208. steps:
  209. - name: Checkout repository
  210. uses: actions/checkout@v4
  211. - name: Set Env
  212. run: |
  213. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  214. shell: bash
  215. - name: Update Tag
  216. uses: richardsimko/update-tag@v1
  217. with:
  218. tag_name: alpha
  219. env:
  220. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  221. - run: |
  222. cat > release.txt << 'EOF'
  223. ## 我应该下载哪个版本?
  224. ### MacOS (提示文件损坏或开发者无法验证请查看下面FAQ)
  225. - MacOS intel芯片: x64.dmg
  226. - MacOS apple M芯片: aarch64.dmg
  227. ### Linux
  228. - Linux 64位: amd64.deb/amd64.rpm
  229. - Linux 32位: i386.deb/i386.rpm
  230. - Linux arm64架构: arm64.deb/aarch64.rpm
  231. - Linux armv7架构: armhf.deb/armhfp.rpm
  232. ### Windows (Win7 用户请查看下面FAQ中的解决方案)
  233. #### 正常版本(推荐)
  234. - 64位: x64-setup.exe
  235. - 32位: x86-setup.exe
  236. - arm64架构: arm64-setup.exe
  237. #### 便携版(不推荐使用,无法自动更新)
  238. - 64位: x64_portable.zip
  239. - 32位: x86_portable.zip
  240. - arm64架构: arm64_portable.zip
  241. #### 内置Webview2版(体积较大,仅在企业版系统或Win7无法安装webview2时使用)
  242. - 64位: x64_fixed_webview2-setup.exe
  243. - 32位: x86_fixed_webview2-setup.exe
  244. - arm64架构: arm64_fixed_webview2-setup.exe
  245. ### FAQ
  246. - [FAQ](https://clash-verge-rev.github.io/faq/windows.html)
  247. Created at ${{ env.BUILDTIME }}.
  248. EOF
  249. - name: Upload Release
  250. uses: softprops/action-gh-release@v2
  251. with:
  252. tag_name: alpha
  253. name: "Clash Verge Rev Alpha"
  254. body_path: release.txt
  255. prerelease: true
  256. token: ${{ secrets.GITHUB_TOKEN }}
  257. generate_release_notes: true