Skip to content

Commit

Permalink
move files to make it easier to add more tasks. Add codepush Service …
Browse files Browse the repository at this point in the history
…Extension
  • Loading branch information
ryuyu committed Feb 18, 2016
1 parent 60d58ff commit ad2c27f
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 105 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ function performDeployTask(accessKey, appName, packagePath, appStoreVersion, dep
description = description || tl.getInput("description", false);
isMandatory = isMandatory || tl.getInput("isMandatory", false);

if (!accessKey) {
var serviceAccount = tl.getEndpointAuthorization(tl.getInput("serviceAccount", true));
accessKey = serviceAccount.password;
}

// Ensure all other users are logged out.
ensureLoggedOut();

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
117 changes: 117 additions & 0 deletions Tasks/code-push-vsts-task/task.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"id": "b69d19a0-7f6d-11e5-a86a-c199aa7a6cf0",
"name": "CodePush",
"friendlyName": "CodePush",
"description": "A VSTS build task for releasing app updates to the CodePush service",
"author": "Microsoft Corporation",
"category": "Deploy",
"visibility": [
"Build",
"Release"
],
"demands": [],
"version": {
"Major": "1",
"Minor": "0",
"Patch": "1"
},
"minimumAgentVersion": "1.83.0",
"instanceNameFormat": "Release $(packagePath) to CodePush ($(appName) - $(deploymentName)) ",
"inputs": [
{
"name": "authType",
"type": "pickList",
"label": "Authentication Method",
"defaultValue": "ServiceAccount",
"helpMarkDown": "",
"options": {
"ServiceAccount": "Service Account",
"AccessKey": "Access Key"
}
},
{
"name": "serviceAccount",
"type": "connectedService:code-push",
"label": "Service Account",
"defaultValue": "",
"required": true,
"helpMarkDown": "The VSTS Service Account that specifies the idenity for Code Push.",
"visibleRule": "authType = ServiceAccount"
},
{
"name": "accessKey",
"type": "string",
"label": "Access Key",
"defaultValue": "",
"required": true,
"helpMarkDown": "Access key used to authenticate with the CodePush service",
"visibleRule": "authType = AccessKey"
},
{
"name": "appName",
"type": "string",
"label": "App Name",
"defaultValue": "",
"required": true,
"helpMarkDown": "Name of the app you want to release an update for"
},
{
"name": "packagePath",
"type": "filePath",
"label": "Package Path",
"defaultValue": "",
"required": true,
"helpMarkDown": "Path to the file or directory that contains the content you want to release"
},
{
"name": "appStoreVersion",
"type": "string",
"label": "App Store Version",
"defaultValue": "",
"required": true,
"helpMarkDown": "The app store version that this release depends on (must be semver compliant)"
},
{
"name": "deploymentName",
"type": "pickList",
"label": "Deployment Name",
"defaultValue": "",
"required": false,
"helpMarkDown": "Name of the deployment under the app which you want to push the release to",
"options": {
"Staging": "Staging",
"Production": "Production"
},
"properties": {
"EditableOptions": "True"
}
},
{
"name": "description",
"type": "string",
"label": "Package Description",
"defaultValue": "",
"required": false,
"helpMarkDown": "Description of the package to be released"
},
{
"name": "isMandatory",
"type": "boolean",
"label": "Mandatory",
"defaultValue": false,
"required": false,
"helpMarkDown": "Specifies whether the release should be considered mandatory"
}
],
"execution": {
"Node": {
"target": "CodePush.js",
"argumentFormat": ""
},
"PowerShell": {
"target": "$(currentDirectory)\\CodePush.ps1",
"argumentFormat": "",
"workingDirectory": "$(currentDirectory)"
}
}
}
File renamed without changes.
25 changes: 16 additions & 9 deletions bin/tfxupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ var path = require("path"),
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;
var promise = Q();
var tasksPath = path.join(process.cwd(), 'Tasks');
var tasks = fs.readdirSync(tasksPath);
console.log(tasks.length + ' tasks found.')
tasks.forEach(function(task) {
promise = promise.then(function() {
console.log('Processing task ' + task);
process.chdir(path.join(tasksPath,task));
return npmInstall();
});

if (process.argv.indexOf("--installonly") == -1) {
promise = promise.then(tfxUpload);
}
});
return promise;
}

function npmInstall() {
Expand Down
96 changes: 0 additions & 96 deletions code-push-vsts-task/task.json

This file was deleted.

34 changes: 34 additions & 0 deletions makevsix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
echo ""
echo "Copyright (c) Microsoft. All rights reserved."
echo "Licensed under the MIT license. See LICENSE file in the project root for full license information."
echo ""

if ! npm --version > /dev/null ; then
echo "npm not found. please install npm and run again."
return 1;
fi

if ! tfx --version > /dev/null ; then
echo "tfx-cli not found. installing..."
npm install -g tfx-cli
fi

echo "Installing Dependencies..."
npm install --only=prod
node bin/tfxupload.js --installonly

if [ $1 == "create" ] ; then
echo "Creating VSIX..."
tfx extension create --manifest-globs vso-extension-android.json --override '{ "public": true }'
fi

if [ $1 == "createtest" ] ; then
echo "Creating Test VSIX..."
tfx extension create --manifest-globs vso-extension-android.json --override '{ "public": "false", "name": "Google Play Store Deploy-Dev", "id": "vso-extension-android-dev", "publisher": "ms-mobiledevops-test"}' --share-with mobiledevops x04ty29er --token $PUBLISH_ACCESSTOKEN
fi

if [ $1 == "publishtest" ] ; then
echo "Creating and publishing test VSIX..."
tfx extension publish --manifest-globs vso-extension-android.json --override '{ "public": "false", "name": "Google Play Store Deploy-Dev", "id": "vso-extension-android-dev", "publisher": "ms-mobiledevops-test"}' --share-with mobiledevops x04ty29er --token $PUBLISH_ACCESSTOKEN
fi
46 changes: 46 additions & 0 deletions vsts-extension-code-push.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,52 @@
"properties": {
"name": "code-push-vsts-task"
}
},
{
"id": "code-push-service-endpoint",
"description": "CodePushAuthenticationEndpoint",
"type": "ms.vss-endpoint.service-endpoint-type",
"targets": [
"ms.vss-endpoint.endpoint-types"
],
"properties": {
"name": "code-push",
"displayName": "Code Push",
"url": "https://microsoft.github.io/code-push",
"inputDescriptors": [],
"authenticationSchemes": [
{
"type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
"inputDescriptors": [
{
"id": "username",
"name": "Username",
"description": "",
"inputMode": "textbox",
"isConfidential": false,
"validation": {
"isRequired": true,
"dataType": "string"
},
"values": {
"isDisabled": true
}
},
{
"id": "password",
"name": "Access Key",
"description": "Access Key from Code Push CLI",
"inputMode": "textbox",
"isConfidential": true,
"validation": {
"isRequired": true,
"dataType": "string"
}
}
]
}
]
}
}
]
}

0 comments on commit ad2c27f

Please sign in to comment.