|
1 | 1 | name: Update Clash-Core and Go Modules |
| 2 | + |
2 | 3 | on: |
3 | 4 | repository_dispatch: |
4 | 5 | types: |
5 | 6 | - core-updated |
6 | 7 | workflow_dispatch: |
7 | 8 |
|
8 | 9 | jobs: |
9 | | - update-dependencies: |
| 10 | + update-go-dependencies: |
10 | 11 | runs-on: ubuntu-latest |
11 | 12 | steps: |
12 | | - - name: Checkout Repository |
13 | | - uses: actions/checkout@v4 |
14 | | - |
15 | | - - name: Checkout and Update submodules |
16 | | - run: git submodule update --init --recursive --remote --force |
17 | | - |
18 | | - - name: Setup Java |
19 | | - uses: actions/setup-java@v4 |
20 | | - with: |
21 | | - distribution: "temurin" |
22 | | - java-version: 21 |
23 | | - |
24 | | - - name: Setup Go |
25 | | - uses: actions/setup-go@v6 |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Checkout submodules # This is required, don't use submodules flag for actions/checkout instead. |
| 15 | + run: git submodule update --init --recursive --force |
| 16 | + - uses: actions/setup-go@v6 |
26 | 17 | with: |
27 | 18 | go-version: "1.26" |
28 | 19 | check-latest: true # Always check for the latest patch release |
29 | | - |
30 | | - - uses: actions/cache@v4 |
31 | | - with: |
32 | | - path: | |
33 | | - ~/.cache/go-build |
34 | | - ~/go/pkg/mod |
35 | | - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
36 | | - restore-keys: | |
37 | | - ${{ runner.os }}-go- |
38 | | -
|
39 | 20 | - name: Install update-go-mod-replace |
40 | 21 | run: | |
41 | 22 | go install github.com/metacubex/update-go-mod-replace@latest |
42 | | -
|
43 | 23 | - name: Update Foss Gomod |
44 | 24 | run: | |
45 | 25 | cd ${{ github.workspace }}/core/src/foss/golang/ |
46 | 26 | update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod |
47 | 27 | go mod tidy |
48 | | -
|
49 | 28 | - name: Update Main Gomod |
50 | 29 | run: | |
51 | 30 | cd ${{ github.workspace }}/core/src/main/golang/ |
52 | 31 | update-go-mod-replace ${{ github.workspace }}/core/src/foss/golang/clash/go.mod $(pwd)/go.mod |
53 | 32 | go mod tidy |
54 | | -
|
55 | 33 | - uses: tibdex/github-app-token@v2 |
56 | 34 | id: generate-token |
57 | 35 | with: |
58 | 36 | app_id: ${{ secrets.MAINTAINER_APPID }} |
59 | 37 | private_key: ${{ secrets.MAINTAINER_APP_PRIVATE_KEY }} |
60 | | - |
61 | 38 | - name: Create Pull Request |
62 | 39 | id: cpr |
63 | 40 | uses: peter-evans/create-pull-request@v6 |
|
73 | 50 | - Update Go Module Dependecies |
74 | 51 | labels: | |
75 | 52 | Update |
76 | | - |
77 | 53 | - name: PR result |
78 | 54 | if: ${{ steps.cpr.outputs.pull-request-number }} |
79 | 55 | run: | |
80 | 56 | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
81 | 57 | echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
82 | | - |
0 commit comments