git-docker/rootfs/usr/local/bin/clone-tag

17 lines
281 B
Bash
Executable File

#!/bin/bash
set -e
FLAGS=""
if [[ -n "${PLUGIN_DEPTH}" ]]; then
FLAGS="--depth=${PLUGIN_DEPTH}"
fi
if [ ! -d .git ]; then
git init
git remote add origin "${DRONE_REMOTE_URL}"
fi
git fetch ${FLAGS} origin "+refs/tags/${DRONE_TAG}:"
git checkout --quiet --force FETCH_HEAD