alpha.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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 Node
  40. uses: actions/setup-node@v4
  41. with:
  42. node-version: "20"
  43. - uses: pnpm/action-setup@v3
  44. name: Install pnpm
  45. with:
  46. version: 9
  47. run_install: false
  48. - name: Pnpm install and check
  49. run: |
  50. pnpm i
  51. pnpm check ${{ matrix.target }}
  52. - name: Download and install Apple intermediate certificates
  53. if: matrix.os == 'macos-latest'
  54. run: |
  55. curl -O https://www.apple.com/certificateauthority/DeveloperIDG2CA.cer
  56. sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain DeveloperIDG2CA.cer
  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. if: startsWith(matrix.target, 'x86_64')
  116. uses: softprops/action-gh-release@v2
  117. with:
  118. tag_name: alpha
  119. name: "Clash Verge Rev Alpha"
  120. body: "More new features are now supported."
  121. prerelease: true
  122. token: ${{ secrets.GITHUB_TOKEN }}
  123. files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
  124. - name: Upload Release
  125. uses: softprops/action-gh-release@v2
  126. with:
  127. tag_name: alpha
  128. name: "Clash Verge Rev Alpha"
  129. body: "More new features are now supported."
  130. prerelease: true
  131. token: ${{ secrets.GITHUB_TOKEN }}
  132. files: |
  133. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  134. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  135. alpha-for-fixed-webview2:
  136. strategy:
  137. fail-fast: false
  138. matrix:
  139. include:
  140. - os: windows-latest
  141. target: x86_64-pc-windows-msvc
  142. arch: x64
  143. - os: windows-latest
  144. target: i686-pc-windows-msvc
  145. arch: x86
  146. - os: windows-latest
  147. target: aarch64-pc-windows-msvc
  148. arch: arm64
  149. runs-on: ${{ matrix.os }}
  150. steps:
  151. - name: Checkout Repository
  152. uses: actions/checkout@v4
  153. - name: Add Rust Target
  154. run: rustup target add ${{ matrix.target }}
  155. - name: Rust Cache
  156. uses: Swatinem/rust-cache@v2
  157. with:
  158. workspaces: src-tauri
  159. - name: Install Node
  160. uses: actions/setup-node@v4
  161. with:
  162. node-version: "20"
  163. - uses: pnpm/action-setup@v3
  164. name: Install pnpm
  165. with:
  166. version: 9
  167. run_install: false
  168. - name: Pnpm install and check
  169. run: |
  170. pnpm i
  171. pnpm check ${{ matrix.target }}
  172. - name: Download WebView2 Runtime
  173. run: |
  174. 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
  175. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  176. Remove-Item .\src-tauri\tauri.windows.conf.json
  177. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  178. - name: Tauri build
  179. id: build
  180. uses: tauri-apps/tauri-action@v0
  181. env:
  182. NODE_OPTIONS: "--max_old_space_size=4096"
  183. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  184. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  185. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  186. with:
  187. tauriScript: pnpm
  188. args: --target ${{ matrix.target }}
  189. - name: Rename
  190. run: |
  191. 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'
  192. 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'
  193. 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'
  194. - name: Upload Release
  195. uses: softprops/action-gh-release@v2
  196. with:
  197. tag_name: alpha
  198. name: "Clash Verge Rev Alpha"
  199. body: "More new features are now supported."
  200. prerelease: true
  201. token: ${{ secrets.GITHUB_TOKEN }}
  202. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  203. - name: Portable Bundle
  204. run: pnpm portable-fixed-webview2 ${{ matrix.target }} --alpha
  205. env:
  206. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  207. update_tag:
  208. name: Update tag
  209. runs-on: ubuntu-latest
  210. needs: [alpha, alpha-for-linux, alpha-for-fixed-webview2]
  211. steps:
  212. - name: Checkout repository
  213. uses: actions/checkout@v4
  214. - name: Set Env
  215. run: |
  216. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  217. shell: bash
  218. - name: Update Tag
  219. uses: richardsimko/update-tag@v1
  220. with:
  221. tag_name: alpha
  222. env:
  223. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  224. - run: |
  225. cat > release.txt << 'EOF'
  226. ## 我应该下载哪个版本?
  227. ### MacOS (提示文件损坏或开发者无法验证请查看下面FAQ)
  228. - MacOS intel芯片: x64.dmg
  229. - MacOS apple M芯片: aarch64.dmg
  230. ### Linux
  231. - Linux 64位: amd64.AppImage/amd64.deb/amd64.rpm
  232. - Linux 32位: i386.deb/i386.rpm
  233. - Linux arm64架构: arm64.deb/aarch64.rpm
  234. - Linux armv7架构: armhf.deb/armhfp.rpm
  235. ### Windows (Win7 用户请查看下面FAQ中的解决方案)
  236. #### 正常版本(推荐)
  237. - 64位: x64-setup.exe
  238. - 32位: x86-setup.exe
  239. - arm64架构: arm64-setup.exe
  240. #### 便携版(不推荐使用,无法自动更新)
  241. - 64位: x64_portable.zip
  242. - 32位: x86_portable.zip
  243. - arm64架构: arm64_portable.zip
  244. #### 内置Webview2版(体积较大,仅在企业版系统或Win7无法安装webview2时使用)
  245. - 64位: x64_fixed_webview2-setup.exe
  246. - 32位: x86_fixed_webview2-setup.exe
  247. - arm64架构: arm64_fixed_webview2-setup.exe
  248. ### FAQ
  249. - [FAQ](https://clash-verge-rev.github.io/faq/windows.html)
  250. Created at ${{ env.BUILDTIME }}.
  251. EOF
  252. - name: Upload Release
  253. uses: softprops/action-gh-release@v2
  254. with:
  255. tag_name: alpha
  256. name: "Clash Verge Rev Alpha"
  257. body_path: release.txt
  258. prerelease: true
  259. token: ${{ secrets.GITHUB_TOKEN }}
  260. generate_release_notes: true