alpha.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. name: Alpha Build
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches: [main]
  6. tags-ignore: [updater, alpha]
  7. permissions: write-all
  8. env:
  9. CARGO_INCREMENTAL: 0
  10. RUST_BACKTRACE: short
  11. jobs:
  12. alpha:
  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: alpha
  67. releaseName: "Clash Verge Rev Alpha"
  68. releaseBody: "More new features are now supported."
  69. releaseDraft: false
  70. prerelease: true
  71. tauriScript: pnpm
  72. args: --target ${{ matrix.target }}
  73. - name: Portable Bundle
  74. if: matrix.os == 'windows-latest'
  75. run: pnpm portable ${{ matrix.target }} --alpha
  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. alpha-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: alpha
  110. name: "Clash Verge Rev Alpha"
  111. body: "More new features are now supported."
  112. prerelease: true
  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: alpha
  119. name: "Clash Verge Rev Alpha"
  120. body: "More new features are now supported."
  121. prerelease: true
  122. token: ${{ secrets.GITHUB_TOKEN }}
  123. files: src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
  124. update_tag:
  125. name: Update tag
  126. runs-on: ubuntu-latest
  127. needs: [alpha, alpha-for-linux]
  128. steps:
  129. - name: Checkout repository
  130. uses: actions/checkout@v4
  131. - name: Set Env
  132. run: |
  133. echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
  134. shell: bash
  135. - name: Update Tag
  136. uses: richardsimko/update-tag@v1
  137. with:
  138. tag_name: alpha
  139. env:
  140. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  141. - run: |
  142. cat > release.txt << 'EOF'
  143. ## Clash Verge Rev Alpha
  144. Created at ${{ env.BUILDTIME }}.
  145. EOF
  146. - name: Upload Release
  147. uses: softprops/action-gh-release@v1
  148. with:
  149. tag_name: alpha
  150. name: "Clash Verge Rev Alpha"
  151. body_path: release.txt
  152. prerelease: true
  153. token: ${{ secrets.GITHUB_TOKEN }}
  154. generate_release_notes: true