|
13 | 13 | - xray-tproxy/entrypoint.sh |
14 | 14 | - .github/workflows/xray-tproxy-docker.yaml |
15 | 15 | workflow_dispatch: |
16 | | - schedule: |
17 | | - - cron: ' 0 22 * * 6' |
18 | 16 |
|
19 | 17 | env: |
20 | 18 | IMAGE_CONTEXT: ./xray-tproxy |
|
25 | 23 | runs-on: ubuntu-latest |
26 | 24 | outputs: |
27 | 25 | remote_version: ${{ steps.remote_version.outputs.remote_version }} |
28 | | - local_version: ${{ steps.local_version.outputs.local_version }} |
29 | | - should_build: ${{ steps.should_build.outputs.should_build }} |
30 | 26 | steps: |
31 | 27 | # 1. 获取远程版本 |
32 | 28 | - name: Get remote version |
|
55 | 51 | echo "Remove Version: $LATEST_DOCKER_TAG" |
56 | 52 | echo "remote_version=$LATEST_DOCKER_TAG" >> $GITHUB_OUTPUT |
57 | 53 |
|
58 | | - # 2. 获取本地版本 |
59 | | - - name: Get local version |
60 | | - id: local_version |
61 | | - run: | |
62 | | - # 使用 curl 和 jq 查询 Docker Hub API |
63 | | - DOCKERHUB_TAG_1=$(curl -s "https://hub.docker.com/v2/repositories/${{ env.REGISTRY_IMAGE }}/tags/" | jq -r '.results[0].name') |
64 | | - DOCKERHUB_TAG_2=$(curl -s "https://hub.docker.com/v2/repositories/${{ env.REGISTRY_IMAGE }}/tags/" | jq -r '.results[1].name') |
65 | | -
|
66 | | - # 排除掉 latest 标签 |
67 | | - if [ "$DOCKERHUB_TAG_2" == "latest" ]; then |
68 | | - DOCKERHUB_TAG=$DOCKERHUB_TAG_1 |
69 | | - elif [ "$DOCKERHUB_TAG_1" == "latest" ]; then |
70 | | - DOCKERHUB_TAG=$DOCKERHUB_TAG_2 |
71 | | - fi |
72 | | -
|
73 | | - if [ -z "$DOCKERHUB_TAG" ] || [ "$DOCKERHUB_TAG" = "null" ]; then |
74 | | - # 如果没有找到任何 Tag (可能是新镜像或 API 失败),我们可以假定需要构建 |
75 | | - echo "Warning: Could not reliably determine Docker Hub latest tag. Assuming build required." |
76 | | - LATEST_DOCKER_TAG="v0.0.0" # 设置一个低版本,确保下一步触发 |
77 | | - else |
78 | | - LATEST_DOCKER_TAG=$DOCKERHUB_TAG |
79 | | - fi |
80 | | - |
81 | | - echo "Local version: $LATEST_DOCKER_TAG" |
82 | | - echo "local_version=$LATEST_DOCKER_TAG" >> $GITHUB_OUTPUT |
83 | | -
|
84 | | - # 3. 判断是否需要触发后续操作 |
85 | | - - name: Check for New Release |
86 | | - id: should_build |
87 | | - run: | |
88 | | - if [ "${{ steps.remote_version.outputs.remote_version }}" != "${{ steps.local_version.outputs.local_version }}" ]; then |
89 | | - echo "New release found! Remote version: ${{ steps.remote_version.outputs.remote_version }}, Local version: ${{ steps.local_version.outputs.local_version }}" |
90 | | - echo "should_build=true" >> $GITHUB_OUTPUT |
91 | | - else |
92 | | - echo "No new release found! Remote version: ${{ steps.remote_version.outputs.remote_version }}, Local version: ${{ steps.local_version.outputs.local_version }}" |
93 | | - echo "should_build=false" >> $GITHUB_OUTPUT |
94 | | - fi |
95 | | -
|
96 | 54 | build-images: |
97 | 55 | runs-on: ubuntu-latest |
98 | 56 | permissions: |
|
110 | 68 | linux/s390x |
111 | 69 | needs: |
112 | 70 | - check-updates |
113 | | - if: ${{ needs.check-updates.outputs.should_build == 'true' }} || || github.event_name == 'workflow_dispatch' |
| 71 | + if: github.event_name == 'workflow_dispatch' |
114 | 72 | steps: |
115 | 73 | - name: Prepare |
116 | 74 | run: | |
|
0 commit comments