Skip to content
Aurélien Maury edited this page Oct 1, 2021 · 1 revision

This snippets depends on Direnv bin dir

Install Drone.io cli in your direnv directory IF no drone binary is found.

Configuration environments variable:

  • DRONE_VERSION (defaults to 'latest' in this doc)
  • DRONE_ARCH (defaults to 'linux_amd64' in this doc)

In your .envrc:

#
# Auto-install Drone
# ==================
#
DRONE_VERSION="latest"
DRONE_ARCH="linux_amd64"
DRONE_PKG_NAME="drone_${DRONE_ARCH}.tar.gz"
DRONE_PKG_URL="https://github.com/drone/drone-cli/releases/${DRONE_VERSION}/download/${DRONE_PKG_NAME}" 
DRONE_PKG_PATH="${DIRENV_TMP_DIR}/${DRONE_PKG_NAME}" 
# if drone binary is not found
if [ ! -e "${DIRENV_BIN_DIR}/drone" ]; then
    echo "===> Getting drone:${DRONE_VERSION}:${DRONE_ARCH} (can take a while to execute)"
    curl -s -L "${DRONE_PKG_URL}" -o "${DRONE_PKG_PATH}"
    tar zx -f ${DRONE_PKG_PATH} -C ${DIRENV_BIN_DIR}
    chmod 700 ${DIRENV_BIN_DIR}/drone
    rm -f ${DRONE_PKG_PATH}
fi
Clone this wiki locally