release.yml 8.1 KB

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