Skip to content

Commit

Permalink
deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
geof90 committed Nov 17, 2015
1 parent 2a02a15 commit c68ebb4
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.vsix
*.vsix
node_modules
45 changes: 45 additions & 0 deletions bin/tfxupload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Copyright (c) Microsoft. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/

var path = require("path"),
fs = require("fs"),
Q = require ("q"),
exec = Q.nfbind(require("child_process").exec);

function installTasks() {
var promise = Q();
var taskPath = path.join(process.cwd(), "code-push-vsts-task");
promise = promise.then(function() {
console.log("Uploading task code-push-vsts-task");
process.chdir(taskPath);
return npmInstall();
})
.then(tfxUpload);
return promise;
}

function npmInstall() {
console.log("Installing npm dependencies for task...");
return exec("npm install --only=prod").then(logExecReturn);
}

function tfxUpload() {
console.log("Transferring...")
return exec("tfx build tasks upload . --overwrite true").then(logExecReturn);
}

function logExecReturn(result) {
console.log(result[0]);
if (result[1] !== "") {
console.error(result[1]);
}
}

installTasks()
.done(function() {
console.log("Upload complete!");
}, function(input) {
console.log("Upload failed!");
});
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "code-push-vsts-extension",
"version": "1.0.0",
"description": "A VSTS extension for releasing app updates to the CodePush service",
"author": "Microsoft",
"license": "MIT",
"dependencies": {
"q": "^1.4.1"
}
}
10 changes: 5 additions & 5 deletions upload.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ REM
REM Copyright (c) Microsoft. All rights reserved.
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
REM
ECHO vso-cordova-tasks upload
ECHO code-push-vsts-extension upload
ECHO Copyright Microsoft Corporation
ECHO.
ECHO This script will acquire and install some dependant node modules. Each package
ECHO is licensed to you by its owner. Microsoft is not responsible for, nor does it
ECHO grant any licenses to, third-party packages. Some packages may include
ECHO dependencies which are governed by additional licenses. Follow the package
ECHO source URL (http://github.com/Microsoft/vso-cordova-tasks) to determine any
ECHO dependencies.
ECHO source URL (http://github.com/Microsoft/code-push-vsts-extension) to determine
ECHO any dependencies.
ECHO.
SET /p YN="Continue [Y/n]? "
IF /I '%YN%'=='n' EXIT /B 1
Expand All @@ -37,13 +37,13 @@ EXIT /B 0
ECHO Installing tfx-cli...
CALL npm install -g tfx-cli
IF NOT %ERRORLEVEL%==0 GOTO INSTALLFAILED
ECHO Log in to the VSO/TFS collection you wish to deploy the tasks.
ECHO Log in to the VSTS/TFS collection you wish to deploy the tasks.
CALL tfx login --authType basic
IF NOT %ERRORLEVEL%==0 GOTO LOGINFAILED
GOTO NPMINSTALL

:UPLOADFAILED
ECHO Failed to upload! Ensure Node.js is installed and in your path and you are logged into a VSO/TFS collection where you have build administration privileges.
ECHO Failed to upload! Ensure Node.js is installed and in your path and you are logged into a VSTS/TFS collection where you have build administration privileges.
EXIT /B %ERRORLEVEL%

:INSTALLFAILED
Expand Down
6 changes: 3 additions & 3 deletions upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

echo "vso-cordova-tasks upload"
echo "code-push-vsts-extension upload"
echo "Copyright Microsoft Corporation"
echo
echo "This script will acquire and install some dependant node modules. Each package"
echo "is licensed to you by its owner. Microsoft is not responsible for, nor does it"
echo "grant any licenses to, third-party packages. Some packages may include"
echo "dependencies which are governed by additional licenses. Follow the package"
echo "source URL (http://github.com/Microsoft/vso-cordova-tasks) to determine any"
echo "source URL (http://github.com/Microsoft/code-push-vsts-extension) to determine any"
echo "dependencies."
echo
read -p "Continue [Y/n]? " yn
Expand All @@ -33,7 +33,7 @@ if ! type "tfx" > /dev/null; then
echo "Failed to install tfx-cli."
exit 1
fi
echo Log in to the VSO/TFS collection you wish to deploy the tasks.
echo Log in to the VSTS/TFS collection you wish to deploy the tasks.
tfx login --authType basic
if [ $? -ne 0 ]
then
Expand Down

0 comments on commit c68ebb4

Please sign in to comment.