release.yml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. cache-all-crates: true
  37. - name: Install Node
  38. uses: actions/setup-node@v4
  39. with:
  40. node-version: "20"
  41. - uses: pnpm/action-setup@v4
  42. name: Install pnpm
  43. with:
  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. APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
  57. APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  58. APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
  59. APPLE_ID: ${{ secrets.APPLE_ID }}
  60. APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
  61. APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  62. with:
  63. tagName: v__VERSION__
  64. releaseName: "Clash Verge Rev v__VERSION__"
  65. releaseBody: "More new features are now supported."
  66. tauriScript: pnpm
  67. args: --target ${{ matrix.target }}
  68. - name: Portable Bundle
  69. if: matrix.os == 'windows-latest'
  70. run: pnpm portable ${{ matrix.target }}
  71. env:
  72. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  73. release-for-linux:
  74. strategy:
  75. fail-fast: false
  76. matrix:
  77. include:
  78. - os: ubuntu-latest
  79. target: x86_64-unknown-linux-gnu
  80. - os: ubuntu-latest
  81. target: i686-unknown-linux-gnu
  82. - os: ubuntu-latest
  83. target: aarch64-unknown-linux-gnu
  84. - os: ubuntu-latest
  85. target: armv7-unknown-linux-gnueabihf
  86. runs-on: ${{ matrix.os }}
  87. steps:
  88. - name: Checkout Repository
  89. uses: actions/checkout@v4
  90. - name: Build for Linux
  91. uses: ./.github/build-for-linux
  92. env:
  93. NODE_OPTIONS: "--max_old_space_size=4096"
  94. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  95. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  96. with:
  97. target: ${{ matrix.target }}
  98. - name: Get Version
  99. run: |
  100. sudo apt-get update
  101. sudo apt-get install jq
  102. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  103. - name: Upload Release
  104. uses: softprops/action-gh-release@v2
  105. with:
  106. tag_name: v${{env.VERSION}}
  107. name: "Clash Verge Rev v${{env.VERSION}}"
  108. body: "More new features are now supported."
  109. token: ${{ secrets.GITHUB_TOKEN }}
  110. files: |
  111. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  112. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  113. release-for-fixed-webview2:
  114. strategy:
  115. fail-fast: false
  116. matrix:
  117. include:
  118. - os: windows-latest
  119. target: x86_64-pc-windows-msvc
  120. arch: x64
  121. - os: windows-latest
  122. target: i686-pc-windows-msvc
  123. arch: x86
  124. - os: windows-latest
  125. target: aarch64-pc-windows-msvc
  126. arch: arm64
  127. runs-on: ${{ matrix.os }}
  128. steps:
  129. - name: Checkout Repository
  130. uses: actions/checkout@v4
  131. - name: Add Rust Target
  132. run: rustup target add ${{ matrix.target }}
  133. - name: Rust Cache
  134. uses: Swatinem/rust-cache@v2
  135. with:
  136. workspaces: src-tauri
  137. - name: Install Node
  138. uses: actions/setup-node@v4
  139. with:
  140. node-version: "20"
  141. - uses: pnpm/action-setup@v4
  142. name: Install pnpm
  143. with:
  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. NODE_OPTIONS: "--max_old_space_size=4096"
  160. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  161. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  162. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  163. with:
  164. tauriScript: pnpm
  165. args: --target ${{ matrix.target }}
  166. - name: Rename
  167. run: |
  168. 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'
  169. 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'
  170. 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'
  171. - name: Upload Release
  172. uses: softprops/action-gh-release@v2
  173. with:
  174. tag_name: v${{steps.build.outputs.appVersion}}
  175. name: "Clash Verge Rev v${{steps.build.outputs.appVersion}}"
  176. body: "More new features are now supported."
  177. token: ${{ secrets.GITHUB_TOKEN }}
  178. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  179. - name: Portable Bundle
  180. run: pnpm portable-fixed-webview2 ${{ matrix.target }}
  181. env:
  182. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  183. release-update:
  184. runs-on: ubuntu-latest
  185. needs: [release, release-for-linux]
  186. steps:
  187. - name: Checkout repository
  188. uses: actions/checkout@v4
  189. - name: Install Node
  190. uses: actions/setup-node@v4
  191. with:
  192. node-version: "20"
  193. - uses: pnpm/action-setup@v4
  194. name: Install pnpm
  195. with:
  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@v4
  214. name: Install pnpm
  215. with:
  216. run_install: false
  217. - name: Pnpm install
  218. run: pnpm i
  219. - name: Release updater file
  220. run: pnpm updater-fixed-webview2
  221. env:
  222. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  223. submit-to-winget:
  224. runs-on: ubuntu-latest
  225. needs: [release-update]
  226. steps:
  227. - name: Checkout repository
  228. uses: actions/checkout@v4
  229. with:
  230. fetch-depth: 0
  231. - name: Get Version
  232. run: |
  233. sudo apt-get update
  234. sudo apt-get install jq
  235. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  236. - name: Submit to Winget
  237. uses: vedantmgoyal9/winget-releaser@main
  238. with:
  239. identifier: ClashVergeRev.ClashVergeRev
  240. version: ${{env.VERSION}}
  241. release-tag: v${{env.VERSION}}
  242. installers-regex: '_(arm64|x64|x86)-setup\.exe$'
  243. token: ${{ secrets.WINGET_TOKEN }}