release.yml 8.5 KB

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