release.yml 9.0 KB

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