release.yml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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: |
  114. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  115. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  116. release-for-fixed-webview2:
  117. strategy:
  118. fail-fast: false
  119. matrix:
  120. include:
  121. - os: windows-latest
  122. target: x86_64-pc-windows-msvc
  123. arch: x64
  124. - os: windows-latest
  125. target: i686-pc-windows-msvc
  126. arch: x86
  127. - os: windows-latest
  128. target: aarch64-pc-windows-msvc
  129. arch: arm64
  130. runs-on: ${{ matrix.os }}
  131. steps:
  132. - name: Checkout Repository
  133. uses: actions/checkout@v4
  134. - name: Add Rust Target
  135. run: rustup target add ${{ matrix.target }}
  136. - name: Rust Cache
  137. uses: Swatinem/rust-cache@v2
  138. with:
  139. workspaces: src-tauri
  140. - name: Install Node
  141. uses: actions/setup-node@v4
  142. with:
  143. node-version: "20"
  144. - uses: pnpm/action-setup@v3
  145. name: Install pnpm
  146. with:
  147. version: 9
  148. run_install: false
  149. - name: Pnpm install and check
  150. run: |
  151. pnpm i
  152. pnpm check ${{ matrix.target }}
  153. - name: Download WebView2 Runtime
  154. run: |
  155. 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
  156. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  157. Remove-Item .\src-tauri\tauri.windows.conf.json
  158. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  159. - name: Tauri build
  160. id: build
  161. uses: tauri-apps/tauri-action@v0
  162. env:
  163. NODE_OPTIONS: "--max_old_space_size=4096"
  164. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  165. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  166. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  167. with:
  168. tauriScript: pnpm
  169. args: --target ${{ matrix.target }}
  170. - name: Rename
  171. run: |
  172. 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'
  173. 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'
  174. 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'
  175. - name: Upload Release
  176. uses: softprops/action-gh-release@v2
  177. with:
  178. tag_name: v${{steps.build.outputs.appVersion}}
  179. name: "Clash Verge Rev v${{steps.build.outputs.appVersion}}"
  180. body: "More new features are now supported."
  181. token: ${{ secrets.GITHUB_TOKEN }}
  182. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  183. - name: Portable Bundle
  184. run: pnpm portable-fixed-webview2 ${{ matrix.target }}
  185. env:
  186. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  187. release-update:
  188. runs-on: ubuntu-latest
  189. needs: [release, release-for-linux]
  190. steps:
  191. - name: Checkout repository
  192. uses: actions/checkout@v4
  193. - name: Install Node
  194. uses: actions/setup-node@v4
  195. with:
  196. node-version: "20"
  197. - uses: pnpm/action-setup@v2
  198. name: Install pnpm
  199. with:
  200. version: 9
  201. run_install: false
  202. - name: Pnpm install
  203. run: pnpm i
  204. - name: Release updater file
  205. run: pnpm updater
  206. env:
  207. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  208. release-update-for-fixed-webview2:
  209. runs-on: ubuntu-latest
  210. needs: [release-for-fixed-webview2]
  211. steps:
  212. - name: Checkout repository
  213. uses: actions/checkout@v4
  214. - name: Install Node
  215. uses: actions/setup-node@v4
  216. with:
  217. node-version: "20"
  218. - uses: pnpm/action-setup@v2
  219. name: Install pnpm
  220. with:
  221. version: 9
  222. run_install: false
  223. - name: Pnpm install
  224. run: pnpm i
  225. - name: Release updater file
  226. run: pnpm updater-fixed-webview2
  227. env:
  228. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}