release.yml 4.5 KB

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