ci.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. name: Release CI
  2. on: [push]
  3. env:
  4. CARGO_INCREMENTAL: 0
  5. RUST_BACKTRACE: short
  6. jobs:
  7. release:
  8. strategy:
  9. matrix:
  10. os: [windows-latest, ubuntu-latest, macos-latest]
  11. runs-on: ${{ matrix.os }}
  12. if: |
  13. startsWith(github.repository, 'zzzgydi') &&
  14. startsWith(github.ref, 'refs/tags/v')
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v2
  18. - name: Install Rust
  19. uses: actions-rs/toolchain@v1
  20. with:
  21. toolchain: stable
  22. profile: minimal
  23. override: true
  24. - name: Rust Cache
  25. uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
  26. with:
  27. working-directory: src-tauri
  28. - name: Install Node
  29. uses: actions/setup-node@v1
  30. with:
  31. node-version: 14
  32. - name: Install Dependencies (ubuntu only)
  33. if: startsWith(matrix.os, 'ubuntu-')
  34. run: |
  35. sudo apt-get update
  36. sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev libayatana-appindicator3-dev
  37. - name: Install ARM64 toolchain (windows only)
  38. if: startsWith(matrix.os, 'windows-')
  39. run: |
  40. rustup target add aarch64-pc-windows-msvc
  41. - name: Get yarn cache dir path
  42. id: yarn-cache-dir-path
  43. run: echo "::set-output name=dir::$(yarn cache dir)"
  44. - name: Yarn Cache
  45. uses: actions/cache@v2
  46. id: yarn-cache
  47. with:
  48. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  49. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  50. restore-keys: |
  51. ${{ runner.os }}-yarn-
  52. - name: Yarn install and check
  53. run: |
  54. yarn install --network-timeout 1000000
  55. yarn run check
  56. - name: Tauri build
  57. uses: tauri-apps/tauri-action@0e558392ccadcb49bcc89e7df15a400e8f0c954d
  58. # enable cache even though failed
  59. # continue-on-error: true
  60. env:
  61. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  63. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  64. with:
  65. tagName: v__VERSION__
  66. releaseName: "Clash Verge v__VERSION__"
  67. releaseBody: "More new features are now supported."
  68. releaseDraft: false
  69. prerelease: true
  70. - name: Tauri build arm64 (windows only)
  71. if: startsWith(matrix.os, 'windows-')
  72. uses: tauri-apps/tauri-action@0e558392ccadcb49bcc89e7df15a400e8f0c954d
  73. # enable cache even though failed
  74. # continue-on-error: true
  75. env:
  76. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  77. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  78. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  79. with:
  80. tagName: v__VERSION__
  81. releaseName: "Clash Verge v__VERSION__"
  82. releaseBody: "More new features are now supported."
  83. releaseDraft: false
  84. prerelease: true
  85. args: --target aarc64-pc-windows-msvc
  86. - name: Portable Bundle
  87. if: matrix.os == 'windows-latest'
  88. # rebuild with env settings
  89. run: |
  90. yarn build
  91. yarn run portable
  92. env:
  93. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  94. TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
  95. TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
  96. VITE_WIN_PORTABLE: 1
  97. release-update:
  98. needs: release
  99. runs-on: macos-latest
  100. if: |
  101. startsWith(github.repository, 'zzzgydi') &&
  102. startsWith(github.ref, 'refs/tags/v')
  103. steps:
  104. - name: Checkout repository
  105. uses: actions/checkout@v2
  106. - name: Get yarn cache dir path
  107. id: yarn-cache-dir-path
  108. run: echo "::set-output name=dir::$(yarn cache dir)"
  109. - name: Yarn Cache
  110. uses: actions/cache@v2
  111. id: yarn-cache
  112. with:
  113. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  114. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  115. restore-keys: |
  116. ${{ runner.os }}-yarn-
  117. - name: Yarn install
  118. run: yarn install
  119. - name: Release updater file
  120. run: yarn run updater
  121. env:
  122. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}