release.yml 4.6 KB

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