alpha.yml 10 KB

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