From ba0b4700fa36fd9eb85339a37be8e7cffc29321b Mon Sep 17 00:00:00 2001 From: Kristian Klausen Date: Sun, 1 Nov 2020 23:27:38 +0100 Subject: [PATCH 1/2] Update description on Dockerhub on release Fix #47 --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c5336f..5250e6b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -180,6 +180,13 @@ release: - apk add jq curl script: - | + # Update the description on https://hub.docker.com/r/archlinux/archlinux + JSON="$(jq -n --arg user "${DOCKERHUB_USERNAME}" --arg pw "${DOCKERHUB_PASSWORD}" '{"username": $user, "password": $pw}')" + TOKEN="$(curl -sf -H "Content-Type: application/json" --data "${JSON}" "https://hub.docker.com/v2/users/login" | jq -er .token)" + JSON="$(jq -n --arg full_description "$(cat README.md)" '{"full_description": $full_description}')" + curl -sf -H "Content-Type: application/json" -H "Authorization: JWT ${TOKEN}" --request PATCH --data "${JSON}" "https://hub.docker.com/v2/repositories/archlinux/archlinux/" + + # Upload rootfs to the Generic Packages Repository for group in base base-devel; do sed -i "s|${group}.tar.xz|${group}-${BUILD_VERSION}.tar.xz|" output/${group}.tar.xz.SHA256 echo "Uploading ${group}.tar.xz" From 24b10ce133ba23abeb77f49ada21f6820e1a7a89 Mon Sep 17 00:00:00 2001 From: Kristian Klausen Date: Sun, 1 Nov 2020 23:59:15 +0100 Subject: [PATCH 2/2] Use httpie for the Dockerhub description update logic --- .gitlab-ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5250e6b..0d2fde8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -177,14 +177,12 @@ release: - $PUBLISH_ARCHLINUX_REPOSITORY == "TRUE" before_script: - apk update - - apk add jq curl + - apk add jq curl httpie script: - | # Update the description on https://hub.docker.com/r/archlinux/archlinux - JSON="$(jq -n --arg user "${DOCKERHUB_USERNAME}" --arg pw "${DOCKERHUB_PASSWORD}" '{"username": $user, "password": $pw}')" - TOKEN="$(curl -sf -H "Content-Type: application/json" --data "${JSON}" "https://hub.docker.com/v2/users/login" | jq -er .token)" - JSON="$(jq -n --arg full_description "$(cat README.md)" '{"full_description": $full_description}')" - curl -sf -H "Content-Type: application/json" -H "Authorization: JWT ${TOKEN}" --request PATCH --data "${JSON}" "https://hub.docker.com/v2/repositories/archlinux/archlinux/" + TOKEN="$(https POST https://hub.docker.com/v2/users/login username="${DOCKERHUB_USERNAME}" password="${DOCKERHUB_PASSWORD}" | jq -er .token)" + https PATCH https://hub.docker.com/v2/repositories/archlinux/archlinux/ Authorization:"JWT ${TOKEN}" full_description="$(cat README.md)" # Upload rootfs to the Generic Packages Repository for group in base base-devel; do