update-dependencies.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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@v3
  13. - name: Checkout submodules
  14. run: git submodule update --init --recursive --remote --force
  15. - name: Setup Java
  16. uses: actions/setup-java@v3
  17. with:
  18. distribution: 'zulu'
  19. java-version: 17
  20. - name: Setup Go
  21. uses: actions/setup-go@v3
  22. with:
  23. go-version: "1.20"
  24. - uses: actions/cache@v3
  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: Update Foss Gomod
  36. run: |
  37. cd ${{ github.workspace }}/core/src/foss/golang/
  38. go mod tidy
  39. - name: Update Main Gomod
  40. run: |
  41. cd ${{ github.workspace }}/core/src/main/golang/native/
  42. go mod tidy
  43. - uses: tibdex/github-app-token@v1
  44. id: generate-token
  45. with:
  46. app_id: ${{ secrets.MAINTAINER_APPID }}
  47. private_key: ${{ secrets.MAINTAINER_APP_PRIVATE_KEY }}
  48. - name: Create Pull Request
  49. id: cpr
  50. uses: peter-evans/create-pull-request@v5
  51. with:
  52. token: ${{ steps.generate-token.outputs.token }}
  53. commit-message: Update Dependencies
  54. branch: update-dependencies
  55. delete-branch: true
  56. title: 'Update Dependencies'
  57. draft: false
  58. body: |
  59. - Update Clash-Meta Core
  60. - Update Go Module Dependecies
  61. labels: |
  62. Update
  63. - name: PR result
  64. if: ${{ steps.cpr.outputs.pull-request-number }}
  65. run: |
  66. echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
  67. echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"