diff --git a/.version b/.version index 2f93383..a3a007c 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v1.3.4 \ No newline at end of file +v1.3.5 \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 253bace..ba408db 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -2,9 +2,18 @@ set -e +# Get the last version in repository +CURRENT_VERSION=$(git describe --abbrev=0 --tags) + # Get the declared version in .version file VERSION=$(cat .version) +# Check if versions are equal +if [ "$CURRENT_VERSION" = "$VERSION" ]; then + echo "Versions are equal. Nothing to publish" + exit 0 +fi + # Tidy the repository go mod tidy @@ -19,7 +28,7 @@ GOPROXY=proxy.golang.org go list -m github.com/Diegiwg/tt@"$VERSION" # Test if the version was published echo "Getting the version from https://pkg.go.dev/github.com/Diegiwg/tt@$VERSION..." -OK=$(curl -o /dev/null -s -w "%{http_code}\n" https://pkg.go.dev/github.com/Diegiwg/tt@"$VERSION") +OK=$(curl -o /dev/null -X 'POST' -s -w "%{http_code}\n" https://pkg.go.dev/github.com/Diegiwg/tt@"$VERSION") if [ "$OK" = "200" ]; then echo "Version $VERSION was published"