release.yml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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 ${HOME}/Library/Keychains/login.keychain-db 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. #加入以下内容为提交app到apple认证,当前会报错,已发邮件与apple沟通
  99. #APPLE_ID: ${{ secrets.APPLE_ID }}
  100. #APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
  101. #APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  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. if: startsWith(matrix.target, 'x86_64')
  111. uses: softprops/action-gh-release@v2
  112. with:
  113. tag_name: v${{env.VERSION}}
  114. name: "Clash Verge Rev v${{env.VERSION}}"
  115. body: "More new features are now supported."
  116. token: ${{ secrets.GITHUB_TOKEN }}
  117. files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
  118. - name: Upload Release
  119. uses: softprops/action-gh-release@v2
  120. with:
  121. tag_name: v${{env.VERSION}}
  122. name: "Clash Verge Rev v${{env.VERSION}}"
  123. body: "More new features are now supported."
  124. token: ${{ secrets.GITHUB_TOKEN }}
  125. files: |
  126. src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  127. src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
  128. release-for-fixed-webview2:
  129. strategy:
  130. fail-fast: false
  131. matrix:
  132. include:
  133. - os: windows-latest
  134. target: x86_64-pc-windows-msvc
  135. arch: x64
  136. - os: windows-latest
  137. target: i686-pc-windows-msvc
  138. arch: x86
  139. - os: windows-latest
  140. target: aarch64-pc-windows-msvc
  141. arch: arm64
  142. runs-on: ${{ matrix.os }}
  143. steps:
  144. - name: Checkout Repository
  145. uses: actions/checkout@v4
  146. - name: Add Rust Target
  147. run: rustup target add ${{ matrix.target }}
  148. - name: Rust Cache
  149. uses: Swatinem/rust-cache@v2
  150. with:
  151. workspaces: src-tauri
  152. - name: Install Node
  153. uses: actions/setup-node@v4
  154. with:
  155. node-version: "20"
  156. - uses: pnpm/action-setup@v3
  157. name: Install pnpm
  158. with:
  159. version: 9
  160. run_install: false
  161. - name: Pnpm install and check
  162. run: |
  163. pnpm i
  164. pnpm check ${{ matrix.target }}
  165. - name: Download WebView2 Runtime
  166. run: |
  167. 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
  168. Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
  169. Remove-Item .\src-tauri\tauri.windows.conf.json
  170. Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
  171. - name: Tauri build
  172. id: build
  173. uses: tauri-apps/tauri-action@v0
  174. env:
  175. NODE_OPTIONS: "--max_old_space_size=4096"
  176. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  177. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  178. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  179. with:
  180. tauriScript: pnpm
  181. args: --target ${{ matrix.target }}
  182. - name: Rename
  183. run: |
  184. 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'
  185. 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'
  186. 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'
  187. - name: Upload Release
  188. uses: softprops/action-gh-release@v2
  189. with:
  190. tag_name: v${{steps.build.outputs.appVersion}}
  191. name: "Clash Verge Rev v${{steps.build.outputs.appVersion}}"
  192. body: "More new features are now supported."
  193. token: ${{ secrets.GITHUB_TOKEN }}
  194. files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
  195. - name: Portable Bundle
  196. run: pnpm portable-fixed-webview2 ${{ matrix.target }}
  197. env:
  198. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  199. release-update:
  200. runs-on: ubuntu-latest
  201. needs: [release, release-for-linux]
  202. steps:
  203. - name: Checkout repository
  204. uses: actions/checkout@v4
  205. - name: Install Node
  206. uses: actions/setup-node@v4
  207. with:
  208. node-version: "20"
  209. - uses: pnpm/action-setup@v2
  210. name: Install pnpm
  211. with:
  212. version: 9
  213. run_install: false
  214. - name: Pnpm install
  215. run: pnpm i
  216. - name: Release updater file
  217. run: pnpm updater
  218. env:
  219. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  220. release-update-for-fixed-webview2:
  221. runs-on: ubuntu-latest
  222. needs: [release-for-fixed-webview2]
  223. steps:
  224. - name: Checkout repository
  225. uses: actions/checkout@v4
  226. - name: Install Node
  227. uses: actions/setup-node@v4
  228. with:
  229. node-version: "20"
  230. - uses: pnpm/action-setup@v2
  231. name: Install pnpm
  232. with:
  233. version: 9
  234. run_install: false
  235. - name: Pnpm install
  236. run: pnpm i
  237. - name: Release updater file
  238. run: pnpm updater-fixed-webview2
  239. env:
  240. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}