@@ -27,14 +27,39 @@ jobs:
2727 exit 1
2828 fi
2929
30- - name : Check if tag already exists
30+ - name : Check if tag already exists locally
3131 run : |
3232 VERSION="${{ github.event.inputs.version }}"
3333 if git rev-parse "$VERSION" >/dev/null 2>&1; then
34- echo "Error: Tag $VERSION already exists"
34+ echo "Error: Tag $VERSION already exists locally "
3535 exit 1
3636 fi
3737
38+ - name : Check if tag already exists on remote
39+ run : |
40+ VERSION="${{ github.event.inputs.version }}"
41+ git fetch --tags
42+ if git ls-remote --tags origin | grep -q "refs/tags/$VERSION$"; then
43+ echo "Error: Tag $VERSION already exists on remote"
44+ echo "⚠️ WARNING: Go modules are immutable. Never reuse or force-push version tags."
45+ echo " Once a version is published, it's permanently recorded in Go's checksum database."
46+ echo " Create a new version instead (e.g., bump to next patch/minor/major version)."
47+ exit 1
48+ fi
49+
50+ - name : Check Go checksum database
51+ run : |
52+ VERSION="${{ github.event.inputs.version }}"
53+ MODULE="github.com/slingdata-io/godbc"
54+ echo "Checking if $MODULE@$VERSION exists in Go checksum database..."
55+ if curl -s "https://sum.golang.org/lookup/$MODULE@$VERSION" | grep -q "$VERSION"; then
56+ echo "Error: $MODULE@$VERSION is already recorded in Go's checksum database"
57+ echo "⚠️ This version cannot be reused. You must create a new version."
58+ exit 1
59+ else
60+ echo "✓ Version $VERSION is available for release"
61+ fi
62+
3863 - name : Create and push tag
3964 run : |
4065 VERSION="${{ github.event.inputs.version }}"
0 commit comments