release.yml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 Tauri CLI
  38. uses: baptiste0928/cargo-install@v3
  39. with:
  40. crate: tauri-cli
  41. git: https://github.com/tauri-apps/tauri
  42. branch: 1.x # `branch` and `commit` are also supported
  43. - name: Install Node
  44. uses: actions/setup-node@v4
  45. with:
  46. node-version: "20"
  47. - uses: pnpm/action-setup@v4
  48. name: Install pnpm
  49. with:
  50. run_install: false
  51. - name: Pnpm install and check
  52. run: |
  53. pnpm i
  54. pnpm check ${{ matrix.target }}
  55. - name: Tauri build
  56. uses: tauri-apps/tauri-action@v0
  57. env:
  58. NODE_OPTIONS: "--max_old_space_size=4096"
  59. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  60. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  61. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  62. APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
  63. APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
  64. APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
  65. APPLE_ID: ${{ secrets.APPLE_ID }}
  66. APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
  67. APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  68. with:
  69. tagName: v__VERSION__
  70. releaseName: "Clash Verge Rev v__VERSION__"
  71. releaseBody: "More new features are now supported."
  72. tauriScript: cargo tauri
  73. args: --target ${{ matrix.target }}
  74. - name: Portable Bundle
  75. if: matrix.os == 'windows-latest'
  76. run: pnpm portable ${{ matrix.target }}
  77. env:
  78. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  79. release-for-linux:
  80. strategy:
  81. fail-fast: false
  82. matrix:
  83. include:
  84. - os: ubuntu-latest
  85. target: x86_64-unknown-linux-gnu
  86. - os: ubuntu-latest
  87. target: i686-unknown-linux-gnu
  88. - os: ubuntu-latest
  89. target: aarch64-unknown-linux-gnu
  90. - os: ubuntu-latest
  91. target: armv7-unknown-linux-gnueabihf
  92. runs-on: ${{ matrix.os }}
  93. steps:
  94. - name: Checkout Repository
  95. uses: actions/checkout@v4
  96. - name: Build for Linux
  97. uses: ./.github/build-for-linux
  98. env:
  99. NODE_OPTIONS: "--max_old_space_size=4096"
  100. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  101. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  102. with:
  103. target: ${{ matrix.target }}
  104. - name: Get Version
  105. run: |
  106. sudo apt-get update
  107. sudo apt-get install jq
  108. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  109. - name: Upload Release
  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: |
  117. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  118. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  119. release-for-fixed-webview2:
  120. strategy:
  121. fail-fast: false
  122. matrix:
  123. include:
  124. - os: windows-latest
  125. target: x86_64-pc-windows-msvc
  126. arch: x64
  127. - os: windows-latest
  128. target: i686-pc-windows-msvc
  129. arch: x86
  130. - os: windows-latest
  131. target: aarch64-pc-windows-msvc
  132. arch: arm64
  133. runs-on: ${{ matrix.os }}
  134. steps:
  135. - name: Checkout Repository
  136. uses: actions/checkout@v4
  137. - name: Add Rust Target
  138. run: rustup target add ${{ matrix.target }}
  139. - name: Rust Cache
  140. uses: Swatinem/rust-cache@v2
  141. with:
  142. workspaces: src-tauri
  143. - name: Install Tauri CLI
  144. run: cargo install --git https://github.com/tauri-apps/tauri --branch 1.x tauri-cli
  145. - name: Install Node
  146. uses: actions/setup-node@v4
  147. with:
  148. node-version: "20"
  149. - uses: pnpm/action-setup@v4
  150. name: Install pnpm
  151. with:
  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@v4
  202. name: Install pnpm
  203. with:
  204. run_install: false
  205. - name: Pnpm install
  206. run: pnpm i
  207. - name: Release updater file
  208. run: pnpm updater
  209. env:
  210. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  211. release-update-for-fixed-webview2:
  212. runs-on: ubuntu-latest
  213. needs: [release-for-fixed-webview2]
  214. steps:
  215. - name: Checkout repository
  216. uses: actions/checkout@v4
  217. - name: Install Node
  218. uses: actions/setup-node@v4
  219. with:
  220. node-version: "20"
  221. - uses: pnpm/action-setup@v4
  222. name: Install pnpm
  223. with:
  224. run_install: false
  225. - name: Pnpm install
  226. run: pnpm i
  227. - name: Release updater file
  228. run: pnpm updater-fixed-webview2
  229. env:
  230. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}