@@ -3,10 +3,10 @@ name: dockerhub-readme-ci
33on :
44 push :
55 branches :
6- - " <your_base_branch> "
6+ - " master "
77 paths :
88# For GitHub Action
9- - " .github/workflows/docker-update- readme.yml"
9+ - " .github/workflows/dockerhub- readme-ci .yml"
1010# For the README file for the Docker Hub
1111 - " README_DOCKERHUB.md"
1212
1616# - "master"
1717# paths:
1818# # For GitHub Action
19- # - ".github/workflows/docker-update- readme.yml"
19+ # - ".github/workflows/dockerhub- readme-ci .yml"
2020# # For the README file for the Docker Hub
2121# - "README_DOCKERHUB.md"
2222
23- env :
24- TEST_TAG : user/clickup-mcp-server:test
25- DOCKER_HUB_SHORT_DESCRIPTION : 🦾 A strong MCP server for ClickUp.
26-
2723jobs :
2824 update-readme :
2925 runs-on : ubuntu-latest
3026 steps :
31- - name : Login to Docker Hub
32- uses : docker/login-action@v3
33- with :
34- username : ${{ secrets.DOCKERHUB_USERNAME }}
35- password : ${{ secrets.DOCKERHUB_TOKEN }}
36-
37- - name : Set up QEMU
38- uses : docker/setup-qemu-action@v3
39-
40- - name : Set up Docker Buildx
41- uses : docker/setup-buildx-action@v3
42- with :
43- buildkitd-flags : --debug
44-
45- - name : Build and push
46- uses : docker/build-push-action@v6
47- with :
48- push : true
49- tags : ${{ env.TEST_TAG }}
50- cache-from : type=gha
51- cache-to : type=gha,mode=max
52-
53- - name : Update repo description in Docker Hub
54- uses : peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0
55- with :
56- username : ${{ secrets.DOCKERHUB_USERNAME }}
57- password : ${{ secrets.DOCKERHUB_TOKEN }}
58- repository : ${{ env.GITHUB_REPOSITORY }}
59- short-description : ${{ env.DOCKER_HUB_SHORT_DESCRIPTION }}
60- readme-filepath : ./README_DOCKERHUB.md
27+ - name : Checkout
28+ uses : actions/checkout@v4
29+
30+ # Change token
31+ - name : Get Docker Hub JWT
32+ env :
33+ U : chisanan232
34+ P : ${{ secrets.DOCKERHUB_README_UPDATE_TOKEN }}
35+ run : |
36+ set -euo pipefail
37+ JWT=$(curl -s -H 'Content-Type: application/json' \
38+ -d "{\"username\":\"${U}\",\"password\":\"${P}\"}" \
39+ https://hub.docker.com/v2/users/login/ | jq -r .token)
40+ test -n "$JWT" -a "$JWT" != null || (echo "JWT empty"; exit 1)
41+ echo "JWT=$JWT" >> $GITHUB_ENV
42+ echo "✅ Got JWT for user: $U"
43+
44+ - name : Update the Docker Hub short description and overview
45+ env :
46+ REPO : ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}
47+ JWT : ${{ env.JWT }}
48+ run : |
49+ set -euo pipefail
50+ ORIG=$(curl -s -H "Authorization: JWT $JWT" \
51+ "https://hub.docker.com/v2/repositories/${REPO}/" | jq -r .full_description)
52+ README_FILE="README_DOCKERHUB.md"
53+ # Read README and encode as a JSON string (preserves newlines/special chars)
54+ NEW=$(jq -Rs . < "$README_FILE")
55+ SHORT_NEW="${{ vars.DOCKER_HUB_SHORT_DESCRIPTION }}"
56+
57+ CODE=$(curl -s -o /dev/null -w '%{http_code}' -X PATCH \
58+ -H "Authorization: JWT $JWT" -H "Content-Type: application/json" \
59+ -d "{\"description\":\"${SHORT_NEW}\", \"full_description\": ${NEW} }" \
60+ "https://hub.docker.com/v2/repositories/${REPO}/")
61+ echo "PATCH full_description -> $CODE"
0 commit comments