release.yml 7.2 KB

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