update-dependencies.yaml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. name: Update Clash-Core and Go Modules
  2. on:
  3. repository_dispatch:
  4. types:
  5. - core-updated
  6. workflow_dispatch:
  7. jobs:
  8. update-dependencies:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout Repository
  12. uses: actions/checkout@v4
  13. - name: Checkout submodules
  14. run: git submodule update --init --recursive --remote --force
  15. - name: Setup Java
  16. uses: actions/setup-java@v4
  17. with:
  18. distribution: 'zulu'
  19. java-version: 17
  20. - name: Setup Go
  21. uses: actions/setup-go@v5
  22. with:
  23. go-version: "1.22"
  24. - uses: actions/cache@v4
  25. with:
  26. path: |
  27. ~/.cache/go-build
  28. ~/go/pkg/mod
  29. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  30. restore-keys: |
  31. ${{ runner.os }}-go-
  32. - name: Download GeoIP Database
  33. run: |
  34. ./gradlew :core:downloadGeoipDatabase
  35. - name: Install update-go-mod-replace
  36. run: |
  37. go install github.com/metacubex/update-go-mod-replace@latest
  38. - name: Update Foss Gomod
  39. run: |
  40. cd ${{ github.workspace }}/core/src/foss/golang/
  41. update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod
  42. go mod tidy
  43. - name: Update Main Gomod
  44. run: |
  45. cd ${{ github.workspace }}/core/src/main/golang/
  46. update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod
  47. go mod tidy
  48. - uses: tibdex/github-app-token@v2
  49. id: generate-token
  50. with:
  51. app_id: ${{ secrets.MAINTAINER_APPID }}
  52. private_key: ${{ secrets.MAINTAINER_APP_PRIVATE_KEY }}
  53. - name: Create Pull Request
  54. id: cpr
  55. uses: peter-evans/create-pull-request@v6
  56. with:
  57. token: ${{ steps.generate-token.outputs.token }}
  58. commit-message: Update Dependencies
  59. branch: update-dependencies
  60. delete-branch: true
  61. title: 'Update Dependencies'
  62. draft: false
  63. body: |
  64. - Update Clash-Meta Core
  65. - Update Go Module Dependecies
  66. labels: |
  67. Update
  68. - name: PR result
  69. if: ${{ steps.cpr.outputs.pull-request-number }}
  70. run: |
  71. echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
  72. echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"