Enhance release process: require new commits for publishing, improve local tag cleanup after successful pushes
This commit is contained in:
@@ -50,6 +50,12 @@ if [[ -z "$latest_version" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
commits_since_release="$(git -C "$repo_root" rev-list --count "$latest_version..HEAD")"
|
||||
if [[ "$commits_since_release" -eq 0 ]]; then
|
||||
echo "No new commits since Git tag $latest_version; nothing to publish." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IFS=. read -r major minor patch <<< "$latest_version"
|
||||
case "$bump" in
|
||||
major)
|
||||
@@ -105,4 +111,9 @@ fi
|
||||
docker push "$image:$version"
|
||||
docker push "$image:latest"
|
||||
|
||||
while IFS= read -r local_image; do
|
||||
[[ -z "$local_image" || "$local_image" == "$image:$version" || "$local_image" == "$image:latest" ]] && continue
|
||||
docker image rm "$local_image"
|
||||
done < <(docker image ls --format '{{.Repository}}:{{.Tag}}' "$image")
|
||||
|
||||
echo "Published $image:$version and $image:latest"
|
||||
Reference in New Issue
Block a user