From 1b21ecf01db9bb9f538d5c24c116f894fa833794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B6rrle?= Date: Thu, 14 Dec 2023 09:31:28 +0100 Subject: [PATCH] update workflow --- .github/workflows/check-versions.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-versions.yml b/.github/workflows/check-versions.yml index be037c4..e13e3eb 100644 --- a/.github/workflows/check-versions.yml +++ b/.github/workflows/check-versions.yml @@ -40,11 +40,17 @@ jobs: exit 1 fi - current_dependencies=$(poetry show --only main | awk '{print $1}') + current_dependencies=$(poetry show --only main --format=json | jq -r '.default.dependencies') manifest_dependencies=$(jq -r '.requirements[]' custom_components/qss/manifest.json) for dependency in $manifest_dependencies; do - if ! echo "$current_dependencies" | grep -q "$dependency"; then + poetry_version_spec=$(poetry show --only main --format=json "$dependency" | jq -r '.version') + normalized_poetry_version_spec=$(awk '{ sub(/[\^~>=]/, "", $0); print }' <<<"$poetry_version_spec") + normalized_manifest_dependency=$(sed 's/=.*,/>=/' <<<"$dependency") + if ! poetry show --only main --format=json "$normalized_manifest_dependency" &>/dev/null; then echo "Error: Missing dependency $dependency in pyproject.toml" exit 1 + elif ! [[ "$normalized_manifest_dependency" =~ $normalized_poetry_version_spec ]]; then + echo "Error: Version mismatch between pyproject.toml ($poetry_version_spec) and manifest.json ($dependency)" + exit 1 fi done