Last active
May 30, 2018 00:15
-
-
Save ben-rogerson/739c49c6417c0155ab12d7049381072b to your computer and use it in GitHub Desktop.
Build Process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($releaseId = ${execution.to_revision.revision} + '-' + ${execution.id} ) | |
mkdir -p deploy-cache | |
mkdir -p shared | |
mkdir -p releases | |
if [ "${execution.refresh}" = "true" ]; then echo "Removing: deploy-cache" && rm -rf deploy-cache/*; fi | |
if [ -d "releases/${releaseId}" ] && [ "${execution.refresh}" = "true" ]; then echo "Removing: releases/${releaseId}" && rm -rf releases/${releaseId}; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Executed on the first pipeline execution only | |
# Popular use case: install packages required by your Run Commands | |
# Changing the image in the Environment tab will run the commands again | |
apt-get update && apt-get install -y wget git zip | |
# curl -L https://phar.phpunit.de/phpunit.phar -o /usr/local/bin/phpunit | |
# chmod +x /usr/local/bin/phpunit | |
curl -sSv https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn install | |
yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See screenshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($releaseId = ${execution.to_revision.revision} + '-' + ${execution.id} ) | |
if [ ! -d "releases/${releaseId}" ]; then echo "Creating: releases/${releaseId}" && cp -a deploy-cache releases/${releaseId}; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($releaseId = ${execution.to_revision.revision} + '-' + ${execution.id} ) | |
touch ${working_dir}/shared/.htaccess; ln -sf ${working_dir}/shared/.htaccess releases/${releaseId}/${web_root}/.htaccess | |
touch ${working_dir}/shared/.user.ini; ln -sf ${working_dir}/shared/.user.ini releases/${releaseId}/${web_root}/.user.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($releaseId = ${execution.to_revision.revision} + '-' + ${execution.id} ) | |
touch ${working_dir}/shared/.env; ln -sf ${working_dir}/shared/.env releases/${releaseId}/.env | |
mkdir -p ${working_dir}/shared/uploads; ln -sf ${working_dir}/shared/uploads releases/${releaseId}/${web_root}/${content_dir}/uploads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($releaseId = ${execution.to_revision.revision} + '-' + ${execution.id} ) | |
echo "Linking current to revision: ${releaseId}" | |
rm -f current | |
ln -s releases/${releaseId} current | |
echo "Check/setup public symlink" | |
if [ ! -L public ]; then mv public old-public; ln -s ${working_dir}/current/${web_root} public; else echo "Public folder already symlinked"; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ $( ls -1d ${working_dir}/releases/* | wc -l ) -gt $( expr ${previous_releases_to_keep} + 1 ) ]; then echo "Deleting the following directories"; ls -t -1d ${working_dir}/releases/* | \tail -n +$( expr ${previous_releases_to_keep} + 1 ); \ls -t -1d ${working_dir}/releases/* | \tail -n +$( expr ${previous_releases_to_keep} + 1 ) | \xargs /bin/rm -rf; fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment