diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a9cef5e --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +.PHONY: image release clean + +all: image + +image: + @docker build -t prologic/action-remark-lint . + +release: + @./tools/release.sh + +clean: + @git clean -f -d -X diff --git a/tools/release.sh b/tools/release.sh new file mode 100755 index 0000000..b8b517d --- /dev/null +++ b/tools/release.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# Get the highest tag number +VERSION="$(git describe --abbrev=0 --tags)" +VERSION=${VERSION:-'v0.0.0'} + +# Strip the v prefix +VERSION="$(echo "$VERSION" | sed -e 's/^v\(.*\)/\1/')" + +# Get number parts +MAJOR="${VERSION%%.*}" +VERSION="${VERSION#*.}" +MINOR="${VERSION%%.*}" +VERSION="${VERSION#*.}" +PATCH="${VERSION%%.*}" +VERSION="${VERSION#*.}" + +# Increase version +PATCH=$((PATCH + 1)) + +TAG="${1}" + +if [ x"${TAG}" = x"" ]; then + TAG="v${MAJOR}.${MINOR}.${PATCH}" +fi + +echo "Releasing ${TAG} ..." + +git tag -a -s -m "Release ${TAG}" "${TAG}" +git push --tags