diff --git a/.github/workflows/publish-container.yml b/.github/workflows/publish-container.yml index 0e931e7..bb2dec8 100644 --- a/.github/workflows/publish-container.yml +++ b/.github/workflows/publish-container.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - sudo apt-get install wget grep + sudo apt-get install wget grep jq - name: Compare version from pip and docker and set version id: getversion run: | diff --git a/scripts/auto_publish/compare-versions b/scripts/auto_publish/compare-versions index 65507b3..f9391af 100755 --- a/scripts/auto_publish/compare-versions +++ b/scripts/auto_publish/compare-versions @@ -8,16 +8,16 @@ pip_latest_version() { python -m pip index versions commitizen | grep commitizen | grep -o -P '[0-9]+\.[0-9]+\.[0-9]+' } -# requires wget, sed, gnu awk +# requires curl & jq list_cz_docker_versions() { - image=commitizen/commitizen - wget -q "https://registry.hub.docker.com/v1/repositories/${image}/tags" -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}' + curl -L -s 'https://registry.hub.docker.com/v2/repositories/commitizen/commitizen/tags/' | jq -r '.results[].name' } PIP_LATEST=$(pip_latest_version) -echo "latest pip version found '$PIP_LATEST'" +printf "latest pip version found:\n%s\n\n" "$PIP_LATEST" tags=$(list_cz_docker_versions) +printf "Docker hub tags found:\n%s\n\n" "$tags" if echo "${tags}" | grep -q "$PIP_LATEST"; then echo "Version already present, skipping other steps..." @@ -28,4 +28,3 @@ else echo "Setting variable 'version'" echo "::set-output name=version::$PIP_LATEST" fi -