diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f1f080..c6e8249 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -444,11 +444,15 @@ jobs: tags: ${{ needs.prepare.outputs.tags }} # For a list of pre-defined annotation keys and value types see: # https://github.com/opencontainers/image-spec/blob/master/annotations.md - - name: Publish README.md to Docker Hub - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - run: ./push_readme.sh + - if: ${{ github.ref_name == 'develop' && github.event_name == 'push' }} + name: Update the Docker Hub description + uses: peter-evans/dockerhub-description@v4 + with: + description: README.md + password: ${{ secrets.DOCKER_PASSWORD }} + repository: ${{ env.IMAGE_NAME }} + short-description: ${{ github.event.repository.description }} + username: ${{ secrets.DOCKER_USERNAME }} - name: Setup tmate debug session uses: mxschmitt/action-tmate@v3 if: env.RUN_TMATE diff --git a/push_readme.sh b/push_readme.sh deleted file mode 100755 index 29b12aa..0000000 --- a/push_readme.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -# Push the README.md file to the Docker Hub repository - -# Requires the following environment variables to be set: -# DOCKER_PASSWORD, DOCKER_USERNAME, IMAGE_NAME - -set -o nounset -set -o errexit -set -o pipefail - -echo "Logging in and requesting JWT..." -token=$(curl --silent --request POST \ - --header "Content-Type: application/json" \ - --data \ - '{"username": "'"$DOCKER_USERNAME"'", "password": "'"$DOCKER_PASSWORD"'"}' \ - https://hub.docker.com/v2/users/login/ | jq --raw-output .token) - -echo "Pushing README file..." -code=$(jq --null-input --arg msg "$(< README.md)" \ - '{"registry":"registry-1.docker.io","full_description": $msg }' \ - | curl --silent --output /dev/null --location --write-out "%{http_code}" \ - https://hub.docker.com/v2/repositories/"${IMAGE_NAME}"/ \ - --data @- --request PATCH \ - --header "Content-Type: application/json" \ - --header "Authorization: JWT ${token}") - -if [[ "${code}" = "200" ]]; then - printf "Successfully pushed README to Docker Hub" -else - printf "Unable to push README to Docker Hub, response code: %s\n" "${code}" - exit 1 -fi