release.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. runs-on: ${{ matrix.os }}
  28. steps:
  29. - name: Checkout Repository
  30. uses: actions/checkout@v4
  31. - name: Apply Patch
  32. if: matrix.target == 'aarch64-pc-windows-msvc'
  33. run: |
  34. git config --global user.email "clash-verge-rev@github.io"
  35. git config --global user.name "clash-verge-rev"
  36. git am patches/support-windows-aarch64.patch
  37. - name: Init Submodule
  38. if: matrix.target == 'aarch64-pc-windows-msvc'
  39. run: git submodule update --init --recursive
  40. - name: Install Rust Stable
  41. uses: dtolnay/rust-toolchain@stable
  42. - name: Add Rust Target
  43. run: rustup target add ${{ matrix.target }}
  44. - name: Rust Cache
  45. uses: Swatinem/rust-cache@v2
  46. with:
  47. workspaces: src-tauri
  48. - name: Install Node
  49. uses: actions/setup-node@v4
  50. with:
  51. node-version: "20"
  52. - uses: pnpm/action-setup@v2
  53. name: Install pnpm
  54. with:
  55. version: 8
  56. run_install: false
  57. - name: Pnpm install and check
  58. run: |
  59. pnpm i
  60. pnpm check ${{ matrix.target }}
  61. - name: Tauri build
  62. uses: tauri-apps/tauri-action@v0
  63. env:
  64. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  65. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  66. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  67. with:
  68. tagName: v__VERSION__
  69. releaseName: "Clash Verge v__VERSION__"
  70. releaseBody: "More new features are now supported."
  71. releaseDraft: false
  72. prerelease: false
  73. tauriScript: pnpm
  74. args: --target ${{ matrix.target }}
  75. - name: Portable Bundle
  76. if: matrix.os == 'windows-latest'
  77. run: pnpm portable ${{ matrix.target }}
  78. env:
  79. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  80. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  81. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  82. release-for-linux:
  83. strategy:
  84. fail-fast: false
  85. matrix:
  86. include:
  87. - os: ubuntu-latest
  88. target: x86_64-unknown-linux-gnu
  89. - os: ubuntu-latest
  90. target: i686-unknown-linux-gnu
  91. - os: ubuntu-latest
  92. target: aarch64-unknown-linux-gnu
  93. # - os: ubuntu-latest
  94. # target: armv7-unknown-linux-gnueabihf
  95. runs-on: ${{ matrix.os }}
  96. steps:
  97. - name: Checkout Repository
  98. uses: actions/checkout@v4
  99. - name: Build for Linux
  100. uses: ./.github/build-for-linux
  101. env:
  102. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  103. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  104. with:
  105. target: ${{ matrix.target }}
  106. - name: Get Version
  107. run: |
  108. sudo apt-get update
  109. sudo apt-get install jq
  110. echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
  111. - name: Upload Release
  112. if: startsWith(matrix.target, 'x86_64') || startsWith(matrix.target, 'i686')
  113. uses: softprops/action-gh-release@v1
  114. with:
  115. tag_name: v${{env.VERSION}}
  116. name: "Clash Verge v${{env.VERSION}}"
  117. body: "More new features are now supported."
  118. token: ${{ secrets.GITHUB_TOKEN }}
  119. files: src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage*
  120. - name: Upload Release
  121. uses: softprops/action-gh-release@v1
  122. with:
  123. tag_name: v${{env.VERSION}}
  124. name: "Clash Verge v${{env.VERSION}}"
  125. body: "More new features are now supported."
  126. token: ${{ secrets.GITHUB_TOKEN }}
  127. files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  128. release-update:
  129. needs: [release]
  130. runs-on: ubuntu-latest
  131. if: startsWith(github.ref, 'refs/tags/v')
  132. steps:
  133. - name: Checkout repository
  134. uses: actions/checkout@v4
  135. - name: Install Node
  136. uses: actions/setup-node@v4
  137. with:
  138. node-version: "20"
  139. - uses: pnpm/action-setup@v2
  140. name: Install pnpm
  141. with:
  142. version: 8
  143. run_install: false
  144. - name: Pnpm install
  145. run: pnpm i
  146. - name: Release updater file
  147. run: pnpm updater
  148. env:
  149. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}