Skip to content

Commit

Permalink
fix: use docker v2 api
Browse files Browse the repository at this point in the history
  • Loading branch information
woile committed Nov 10, 2022
1 parent 120c7ee commit 539f232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 4 additions & 5 deletions scripts/auto_publish/compare-versions
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -28,4 +28,3 @@ else
echo "Setting variable 'version'"
echo "::set-output name=version::$PIP_LATEST"
fi

0 comments on commit 539f232

Please sign in to comment.