-
Notifications
You must be signed in to change notification settings - Fork 14
/
deploy.sh
40 lines (29 loc) · 1.78 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Install latest Ruby gems (if any)
bundle install --without development || { echo 'Installing Ruby gems failed.'; exit 1; }
# Build the documentation
bundle exec jekyll build || { echo 'Building the documentation with Jekyll failed.'; exit 1; }
# Copy the _site directory to \\telerik.com\Resources\AppDirector\Drops\Xamarin\Xamarin.Docs
robocopy _site //telerik.com/Resources/AppDirector/Drops/Xamarin/Xamarin.Docs -purge -s
VERSION="1.0.`date +%s`";
PAYLOAD="{ \"Folder\": \"//telerik.com/Resources/AppDirector/Drops/Xamarin\", \"Version\": \"$VERSION\", \"Environment\": \"Test\", \"RepositoryName\": \"Local\", \"Workspace\": \"Documentation\", \"ClientId\": \"uri:platform.cp.builds\", \"ClientSecret\": \"3edd5acdb61db37f3ab2bd735b058911\", \"SkipRegisterPackage\": false, \"OverwritePackage\": false, \"SkipDateChange\": true, \"SkipDeployment\": false, \"DeploymentApiUrl\": \"http://deploy.telerik.com/api/deployment/v1\", \"RepositoryUrl\": \"http://deploy.telerik.com/api/repository/v1\", \"TokenEndpoint\": \"https://identity.telerik.com/v2/oauth/telerik/token\", \"PackageNameFormat\": \"package-{0}-{1}.zip\" }";
echo "posting $PAYLOAD";
curl -X POST -d "$PAYLOAD" -H "Accept: application/json" -H "Content-Type: application/json" http://deploy.telerik.com/api/deployment/v1/packages
RESULT=''
while [ "$RESULT" != "success" ]
do
if [ "$RESULT" = 'fail' ]
then
echo 'Deployment failed :(';
exit 1;
elif [ "$RESULT" = 'unknown' ]
then
echo 'Deployment failed :(';
exit 1;
else
RESULT=$(curl -s http://deploy.telerik.com/api/deployment/v1/workspaces/Documentation/stacks/Xamarin.Docs/environments/Test/status)
echo "Deployment in progress, current status: $RESULT"
sleep 2
fi
done
echo 'Deployment passed :)'