renovate/hooks/post_checkout

21 lines
476 B
Bash

#!/bin/bash
set -e
echo "repo=${DOCKER_REPO}"
echo "tag=${DOCKER_TAG}"
SEMVER_REGEX="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-slim)?$"
if ! [[ "$DOCKER_TAG" =~ $SEMVER_REGEX ]]; then
echo Not a semver tag - skipping
exit
fi
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
# Write the tag to package.json>version so that "renovate --version" is correct
sed -i "s/0.0.0-semantic-release/${major}.${minor}.${patch}/" package.json