chore: fall back to latest tag when semantic-release finds no new commits

Allows re-triggering the release workflow after a Docker push failure
without needing new commits. If semantic-release produces no new version
the workflow now uses the latest existing git tag for the Docker build.
This commit is contained in:
ashim-hq
2026-04-17 00:21:55 +08:00
parent fd1eb9c781
commit 62f0a2a238
+11 -2
View File
@@ -45,8 +45,17 @@ jobs:
if [ -f .release-version ]; then
echo "version=$(cat .release-version)" >> "$GITHUB_OUTPUT"
else
echo "::error::semantic-release did not produce a new version. No releasable commits found."
exit 1
# semantic-release found no new commits — tag already exists from a
# previous run. Fall back to the latest git tag so the Docker build
# jobs still run (useful when re-triggering after a push failure).
latest=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
if [ -n "$latest" ]; then
echo "version=$latest" >> "$GITHUB_OUTPUT"
echo "Re-using existing tag v${latest} for Docker build."
else
echo "::error::semantic-release did not produce a new version. No releasable commits found."
exit 1
fi
fi
docker: