Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
Deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
cncgoko committed Jan 15, 2017
1 parent ae62790 commit dbe4fe0
Showing 1 changed file with 16 additions and 36 deletions.
52 changes: 16 additions & 36 deletions deploy.sh
@@ -1,23 +1,18 @@
#!/bin/bash

#$1 is baseFolder, $2 is subfolders array
deleteFolders(){
for file in $(curl -s -l -u $VAR1:$VAR2 $TARGET$1);
do
echo "Removing file www/download/$1$file"
curl -u $VAR1:$VAR2 $TARGET$1 -X "DELE $file"
done
echo "Removing folder www/download/$1"
curl -u $VAR1:$VAR2 $TARGET -X "RMD $1"

renameFolders(){
echo "Renaming folder $1 to $2"
curl -u $VAR1:$VAR2 $TARGET/$UPDATE_FOLDER/ -Q "-RNFR $1" -Q "-RNTO $2"

}

# Clean the distant repository
cleanRepository(){
echo "Cleaning repository..."
deleteFolders update/$gokoVersion/binary/
deleteFolders update/$gokoVersion/plugins/
deleteFolders update/$gokoVersion/features/
# Archive the distant repository
archiveRepository(){
echo "Archiving repository..."
timestamp=`date +"%Y%m%d%H%M%S"`
archivedRepoName=$gokoVersion"_"$timestamp
curl -u $VAR1:$VAR2 $TARGET/$UPDATE_FOLDER/ -Q "-RNFR $gokoVersion" -Q "-RNTO $archivedRepoName"

}

# Export the built repository to destination
Expand All @@ -29,30 +24,15 @@ exportRepository(){
find . -type f -exec curl --ftp-create-dirs -T {} -u $VAR1:$VAR2 $TARGET/$UPDATE_FOLDER/$gokoVersion/{} \;
}

# Export the built binaries to destination
exportBinaries(){
echo "Exporting binaries..."

# cd $TRAVIS_BUILD_DIR/org.goko.build.product/target/products/

# curl --ftp-create-dirs -T org.goko-win32.win32.x86_64.zip -u $VAR1:$VAR2 $TARGET/$gokoVersion/org.goko-win32.win32.x86_64.zip
# curl --ftp-create-dirs -T org.goko-win32.win32.x86.zip -u $VAR1:$VAR2 $TARGET/$gokoVersion/org.goko-win32.win32.x86.zip
# curl --ftp-create-dirs -T org.goko-linux.gtk.x86_64.zip -u $VAR1:$VAR2 $TARGET/$gokoVersion/org.goko-linux.gtk.x86_64.zip
# curl --ftp-create-dirs -T org.goko-linux.gtk.x86.zip -u $VAR1:$VAR2 $TARGET/$gokoVersion/org.goko-linux.gtk.x86.zip

}
# Let's do it
if [ $updateRepository == 'true' ]
then
cleanRepository
if curl -u $VAR1:$VAR2 --output /dev/null --silent --head --fail "$TARGET/$UPDATE_FOLDER/$gokoVersion/"; then
# previous repo already exists, let's archive it
archiveRepository
fi

exportRepository
else
echo "Skipped repository export..."
fi

#if [ $updateBinaries == 'true' ]
#then
# exportBinaries
#else
# echo "Skipped binaries export..."
#fi

0 comments on commit dbe4fe0

Please sign in to comment.