release.yml 8.6 KB

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