#!/bin/bash # Create folders based on BRANCH for publishing debian packages using git-flow # The develop branches, push to development # The release/* branches, pushed to testing # The hotfix/* branches, pushed to acceptation # The master branch, pushed to acceptation and production ## DIST_PATH="./build/dist" if [ -z "${BRANCH_NAME}" ]; then BRANCH_NAME=`git rev-parse --abbrev-ref HEAD` fi # Deploy all *.deb packages to a selected repository # $1: development, testing, acceptation, production deploy_to() { echo "Continuous deployment push branch '${BRANCH_NAME}' to '$1' repository" mkdir -p ${DIST_PATH}/$1 cp build/Release/*.deb -v ${DIST_PATH}/$1/ } if [[ "${BRANCH_NAME}" == "develop" ]]; then deploy_to "development" elif [[ "${BRANCH_NAME}" =~ ^release/* ]]; then deploy_to "testing" elif [[ "${BRANCH_NAME}" =~ ^hotfix/* ]]; then deploy_to "acceptation" elif [[ "${BRANCH_NAME}" == "master" ]]; then deploy_to "acceptation" deploy_to "production" else echo "No continuous deployment action for '${BRANCH_NAME}' branch" fi