release.yml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. name: Release Build
  2. on:
  3. workflow_dispatch:
  4. permissions: write-all
  5. env:
  6. CARGO_INCREMENTAL: 0
  7. RUST_BACKTRACE: short
  8. jobs:
  9. release:
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. include:
  14. - os: windows-latest
  15. target: x86_64-pc-windows-msvc
  16. - os: windows-latest
  17. target: i686-pc-windows-msvc
  18. - os: windows-latest
  19. target: aarch64-pc-windows-msvc
  20. - os: macos-latest
  21. target: aarch64-apple-darwin
  22. - os: macos-latest
  23. target: x86_64-apple-darwin
  24. runs-on: ${{ matrix.os }}
  25. steps:
  26. - name: Checkout Repository
  27. uses: actions/checkout@v4
  28. - name: Install Rust Stable
  29. uses: dtolnay/rust-toolchain@1.77.0
  30. - name: Add Rust Target
  31. run: rustup target add ${{ matrix.target }}
  32. - name: Rust Cache
  33. uses: Swatinem/rust-cache@v2
  34. with:
  35. workspaces: src-tauri
  36. - name: Install Node
  37. uses: actions/setup-node@v4
  38. with:
  39. node-version: "20"
  40. - uses: pnpm/action-setup@v3
  41. name: Install pnpm
  42. with:
  43. version: 9
  44. run_install: false
  45. - name: Pnpm install and check
  46. run: |
  47. pnpm i
  48. pnpm check ${{ matrix.target }}
  49. - name: Tauri build
  50. uses: tauri-apps/tauri-action@v0
  51. env:
  52. NODE_OPTIONS: "--max_old_space_size=4096"
  53. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  54. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  55. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  56. with:
  57. tagName: v__VERSION__
  58. releaseName: "Clash Verge Rev v__VERSION__"
  59. releaseBody: "More new features are now supported."
  60. tauriScript: pnpm
  61. args: --target ${{ matrix.target }}
  62. - name: Portable Bundle
  63. if: matrix.os == 'windows-latest'
  64. run: pnpm portable ${{ matrix.target }}
  65. env:
  66. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  67. release-for-linux:
  68. strategy:
  69. fail-fast: false
  70. matrix:
  71. include:
  72. - os: ubuntu-latest
  73. target: x86_64-unknown-linux-gnu
  74. - os: ubuntu-latest
  75. target: i686-unknown-linux-gnu
  76. - os: ubuntu-latest
  77. target: aarch64-unknown-linux-gnu
  78. - os: ubuntu-latest
  79. target: armv7-unknown-linux-gnueabihf
  80. runs-on: ${{ matrix.os }}
  81. steps:
  82. - name: Checkout Repository
  83. uses: actions/checkout@v4
  84. - name: Build for Linux
  85. uses: ./.github/build-for-linux
  86. env:
  87. NODE_OPTIONS: "--max_old_space_size=4096"
  88. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  89. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  90. with:
  91. target: ${{ matrix.target }}
  92. - name: Get Version
  93. run: |
  94. sudo apt-get update
  95. sudo apt-get install jq
  96. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  97. - name: Upload Release
  98. if: startsWith(matrix.target, 'x86_64')
  99. uses: softprops/action-gh-release@v2
  100. with:
  101. tag_name: v${{env.VERSION}}
  102. name: "Clash Verge Rev v${{env.VERSION}}"
  103. body: "More new features are now supported."
  104. token: ${{ secrets.GITHUB_TOKEN }}
  105. files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
  106. - name: Upload Release
  107. uses: softprops/action-gh-release@v2
  108. with:
  109. tag_name: v${{env.VERSION}}
  110. name: "Clash Verge Rev v${{env.VERSION}}"
  111. body: "More new features are now supported."
  112. token: ${{ secrets.GITHUB_TOKEN }}
  113. files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  114. release-for-fixed-webview2:
  115. strategy:
  116. fail-fast: false
  117. matrix:
  118. include:
  119. - os: windows-latest
  120. target: x86_64-pc-windows-msvc
  121. arch: x64
  122. - os: windows-latest
  123. target: i686-pc-windows-msvc
  124. arch: x86
  125. - os: windows-latest
  126. target: aarch64-pc-windows-msvc
  127. arch: arm64
  128. runs-on: ${{ matrix.os }}
  129. steps:
  130. - name: Checkout Repository
  131. uses: actions/checkout@v4
  132. - name: Add Rust Target
  133. run: rustup target add ${{ matrix.target }}
  134. - name: Rust Cache
  135. uses: Swatinem/rust-cache@v2
  136. with:
  137. workspaces: src-tauri
  138. - name: Install Node
  139. uses: actions/setup-node@v4
  140. with:
  141. node-version: "20"
  142. - uses: pnpm/action-setup@v3
  143. name: Install pnpm
  144. with:
  145. version: 9
  146. run_install: false
  147. - name: Pnpm install and check
  148. run: |
  149. pnpm i
  150. pnpm check ${{ matrix.target }}
  151. - name: Download WebView2 Runtime
  152. run: |
  153. 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
  154. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  155. Remove-Item .\src-tauri\tauri.windows.conf.json
  156. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  157. - name: Tauri build
  158. id: build
  159. uses: tauri-apps/tauri-action@v0
  160. env:
  161. NODE_OPTIONS: "--max_old_space_size=4096"
  162. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  163. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  164. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  165. with:
  166. tauriScript: pnpm
  167. args: --target ${{ matrix.target }}
  168. - name: Rename
  169. run: |
  170. 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'
  171. 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'
  172. 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'
  173. - name: Upload Release
  174. uses: softprops/action-gh-release@v2
  175. with:
  176. tag_name: v${{steps.build.outputs.appVersion}}
  177. name: "Clash Verge Rev v${{steps.build.outputs.appVersion}}"
  178. body: "More new features are now supported."
  179. token: ${{ secrets.GITHUB_TOKEN }}
  180. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  181. - name: Portable Bundle
  182. run: pnpm portable-fixed-webview2 ${{ matrix.target }}
  183. env:
  184. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  185. release-update:
  186. runs-on: ubuntu-latest
  187. needs: [release, release-for-linux]
  188. steps:
  189. - name: Checkout repository
  190. uses: actions/checkout@v4
  191. - name: Install Node
  192. uses: actions/setup-node@v4
  193. with:
  194. node-version: "20"
  195. - uses: pnpm/action-setup@v2
  196. name: Install pnpm
  197. with:
  198. version: 9
  199. run_install: false
  200. - name: Pnpm install
  201. run: pnpm i
  202. - name: Release updater file
  203. run: pnpm updater
  204. env:
  205. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  206. release-update-for-fixed-webview2:
  207. runs-on: ubuntu-latest
  208. needs: [release-for-fixed-webview2]
  209. steps:
  210. - name: Checkout repository
  211. uses: actions/checkout@v4
  212. - name: Install Node
  213. uses: actions/setup-node@v4
  214. with:
  215. node-version: "20"
  216. - uses: pnpm/action-setup@v2
  217. name: Install pnpm
  218. with:
  219. version: 9
  220. run_install: false
  221. - name: Pnpm install
  222. run: pnpm i
  223. - name: Release updater file
  224. run: pnpm updater-fixed-webview2
  225. env:
  226. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}