release.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. name: Release Build
  2. on:
  3. workflow_dispatch:
  4. push:
  5. tags:
  6. - v**
  7. env:
  8. CARGO_INCREMENTAL: 0
  9. RUST_BACKTRACE: short
  10. jobs:
  11. release:
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. include:
  16. - os: windows-latest
  17. target: x86_64-pc-windows-msvc
  18. - os: windows-latest
  19. target: i686-pc-windows-msvc
  20. # - os: windows-latest
  21. # target: aarch64-pc-windows-msvc
  22. - os: macos-latest
  23. target: aarch64-apple-darwin
  24. - os: macos-latest
  25. target: x86_64-apple-darwin
  26. - os: ubuntu-latest
  27. target: x86_64-unknown-linux-gnu
  28. - os: ubuntu-latest
  29. target: aarch64-unknown-linux-gnu
  30. # - os: ubuntu-latest
  31. # target: armv7-unknown-linux-gnueabihf
  32. runs-on: ${{ matrix.os }}
  33. steps:
  34. - name: Checkout Repository
  35. uses: actions/checkout@v4
  36. - name: Install Rust Stable
  37. uses: dtolnay/rust-toolchain@stable
  38. - name: Add Rust Target
  39. run: |
  40. rustup target add ${{ matrix.target }}
  41. - name: Rust Cache
  42. uses: Swatinem/rust-cache@v2
  43. with:
  44. workspaces: src-tauri
  45. - name: Install Node
  46. uses: actions/setup-node@v4
  47. with:
  48. node-version: "20"
  49. - uses: pnpm/action-setup@v2
  50. name: Install pnpm
  51. with:
  52. version: 8
  53. run_install: false
  54. - name: Install Dependencies (Ubuntu Only)
  55. if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.target,'x86_64')
  56. run: |
  57. sudo apt-get update
  58. sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf openssl
  59. - name: Install Dependencies (Ubuntu Only)
  60. if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.target,'aarch64')
  61. run: |
  62. sed 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch-=amd64] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list
  63. sudo sed -i 's/mirror+file/[arch=amd64] mirror+file/g' /etc/apt/sources.list
  64. cat /etc/apt/sources.list
  65. cat /etc/apt/sources.list.d/ports.list
  66. sudo dpkg --add-architecture arm64
  67. sudo apt-get update
  68. sudo apt-get install -y libncurses6:arm64 libtinfo6:arm64 linux-libc-dev:arm64 libncursesw6:arm64 libssl3:arm64 libcups2:arm64
  69. sudo apt-get install -y --no-install-recommends g++-aarch64-linux-gnu libc6-dev-arm64-cross libssl-dev:arm64 libwebkit2gtk-4.0-dev:arm64 libgtk-3-dev:arm64 patchelf:arm64 librsvg2-dev:arm64 libayatana-appindicator3-dev:arm64
  70. - name: Install Dependencies (Ubuntu Only)
  71. if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.target,'armv7')
  72. run: |
  73. sed 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch-=amd64] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list
  74. sudo sed -i 's/mirror+file/[arch=amd64] mirror+file/g' /etc/apt/sources.list
  75. cat /etc/apt/sources.list
  76. cat /etc/apt/sources.list.d/ports.list
  77. sudo dpkg --add-architecture armhf
  78. sudo apt-get update
  79. sudo apt-get install -y libncurses6:armhf libtinfo6:armhf linux-libc-dev:armhf libncursesw6:armhf libssl3:armhf libcups2:armhf
  80. sudo apt-get install -y --no-install-recommends g++-arm-linux-gnueabihf libc6-dev-armhf-cross libssl-dev:armhf libwebkit2gtk-4.0-dev:armhf libgtk-3-dev:armhf patchelf:armhf librsvg2-dev:armhf libayatana-appindicator3-dev:armhf
  81. - name: Pnpm install and check
  82. run: |
  83. pnpm i
  84. pnpm check ${{ matrix.target }}
  85. - name: Tauri build
  86. if: startsWith(matrix.os, 'windows') || startsWith(matrix.os,'macos') || startsWith(matrix.target,'x86_64')
  87. uses: tauri-apps/tauri-action@v0
  88. env:
  89. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  90. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  91. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  92. with:
  93. tagName: v__VERSION__
  94. releaseName: "Clash Verge v__VERSION__"
  95. releaseBody: "More new features are now supported."
  96. releaseDraft: false
  97. prerelease: false
  98. tauriScript: pnpm
  99. args: -f default-meta --target ${{ matrix.target }}
  100. - name: Tauri build (Ubuntu Arm64)
  101. if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.target,'aarch64')
  102. uses: tauri-apps/tauri-action@v0
  103. env:
  104. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  105. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  106. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  107. CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
  108. CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
  109. CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
  110. PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
  111. PKG_CONFIG_ALLOW_CROSS: 1
  112. with:
  113. tagName: v__VERSION__
  114. releaseName: "Clash Verge v__VERSION__"
  115. releaseBody: "More new features are now supported."
  116. releaseDraft: false
  117. prerelease: false
  118. tauriScript: pnpm
  119. args: -f default-meta --target ${{ matrix.target }} -b deb,updater
  120. - name: Tauri build (Ubuntu Armv7)
  121. if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.target,'armv7')
  122. uses: tauri-apps/tauri-action@v0
  123. env:
  124. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  125. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  126. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  127. CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
  128. CC_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
  129. CXX_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-g++
  130. PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig
  131. PKG_CONFIG_ALLOW_CROSS: 1
  132. with:
  133. tagName: v__VERSION__
  134. releaseName: "Clash Verge v__VERSION__"
  135. releaseBody: "More new features are now supported."
  136. releaseDraft: false
  137. prerelease: false
  138. tauriScript: pnpm
  139. args: -f default-meta --target ${{ matrix.target }} -b deb,updater
  140. - name: Portable Bundle
  141. if: matrix.os == 'windows-latest'
  142. run: |
  143. pnpm portable
  144. env:
  145. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  146. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  147. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  148. VITE_WIN_PORTABLE: 1
  149. release-update:
  150. needs: [release]
  151. runs-on: ubuntu-latest
  152. if: startsWith(github.ref, 'refs/tags/v')
  153. steps:
  154. - name: Checkout repository
  155. uses: actions/checkout@v4
  156. - name: Install Node
  157. uses: actions/setup-node@v4
  158. with:
  159. node-version: "20"
  160. - uses: pnpm/action-setup@v2
  161. name: Install pnpm
  162. with:
  163. version: 8
  164. run_install: false
  165. - name: Pnpm install
  166. run: pnpm i
  167. - name: Release updater file
  168. run: pnpm updater
  169. env:
  170. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}