release.yml 4.6 KB

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