-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 221ae40
Showing
18 changed files
with
720 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea/ | ||
.vscode/ | ||
node_modules/ | ||
build/ | ||
tmp/ | ||
temp/ |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"CurrentProjectSetting": null | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"ExpandedNodes": [ | ||
"" | ||
], | ||
"SelectedNode": "\\app.js", | ||
"PreviewInSolutionExplorer": false | ||
} |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "{WEB_SITE_NAME}", | ||
"description": "{WEB_SITE_NAME} Azure Bot Service Code", | ||
"homepage": "https://github.com", | ||
"private": false, | ||
"has_issues": true, | ||
"has_projects": true, | ||
"has_wiki": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
rem @echo off | ||
setlocal | ||
SET password=%1 | ||
SET repoName=srcRepo | ||
SET repoUrl=file:///%HOMEDRIVE:~0,1%/%HOMEPATH:~1%/site/%repoName% | ||
SET download=bot-src | ||
|
||
echo %repoUrl% | ||
|
||
rem cd to project root | ||
pushd ..\wwwroot | ||
|
||
rem init git | ||
call git init | ||
call git config user.name "botframework" | ||
call git config user.email "[email protected]" | ||
call git add . | ||
call git commit -m "prepare to download source" | ||
call git remote add srcRepo %repoUrl% | ||
popd | ||
|
||
rem init upstream | ||
pushd %HOME%\site | ||
mkdir srcRepo | ||
cd srcRepo | ||
call git init --bare | ||
popd | ||
|
||
rem push to upstream | ||
pushd ..\wwwroot | ||
call git push --set-upstream srcRepo master | ||
popd | ||
|
||
rem clone srcRepo | ||
pushd %HOME%\site | ||
call git clone %repoUrl% %download% | ||
rem delete .git | ||
cd %download% | ||
call rm -r -f .git | ||
popd | ||
|
||
rem prepare for publish | ||
type PostDeployScripts\publish.js.template | sed -e s/\{WEB_SITE_NAME\}/%WEBSITE_SITE_NAME%/g | sed -e s/\{PASSWORD\}/%password%/g > %HOME%\site\%download%\publish.js | ||
|
||
rem preare the zip file | ||
%HOMEDRIVE%\7zip\7za a %HOME%\site\%download%.zip %HOME%\site\%download%\* | ||
|
||
rem cleanup git stuff | ||
pushd ..\wwwroot | ||
call rm -r -f .git | ||
popd | ||
|
||
pushd %HOME%\site | ||
call rm -r -f %download% | ||
call rm -r -f %repoName% | ||
popd | ||
|
||
endlocal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var zipFolder = require('zip-folder'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var request = require('request'); | ||
|
||
var rootFolder = path.resolve('.'); | ||
var zipPath = path.resolve(rootFolder, '../{WEB_SITE_NAME}.zip'); | ||
var kuduApi = 'https://{WEB_SITE_NAME}.scm.azurewebsites.net/api/zip/site/wwwroot'; | ||
var userName = '${WEB_SITE_NAME}'; | ||
var password = '{PASSWORD}'; | ||
|
||
function uploadZip(callback) { | ||
fs.createReadStream(zipPath).pipe(request.put(kuduApi, { | ||
auth: { | ||
username: userName, | ||
password: password, | ||
sendImmediately: true | ||
}, | ||
headers: { | ||
"Content-Type": "applicaton/zip" | ||
} | ||
})) | ||
.on('response', function(resp){ | ||
if (resp.statusCode >= 200 && resp.statusCode < 300) { | ||
fs.unlink(zipPath); | ||
callback(null); | ||
} else if (resp.statusCode >= 400) { | ||
callback(resp); | ||
} | ||
}) | ||
.on('error', function(err) { | ||
callback(err) | ||
}); | ||
} | ||
|
||
function publish(callback) { | ||
zipFolder(rootFolder, zipPath, function(err) { | ||
if (!err) { | ||
uploadZip(callback); | ||
} else { | ||
callback(err); | ||
} | ||
}) | ||
} | ||
|
||
publish(function(err) { | ||
if (!err) { | ||
console.log('{WEB_SITE_NAME} publish'); | ||
} else { | ||
console.error('failed to publish {WEB_SITE_NAME}', err); | ||
} | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@echo off | ||
setlocal | ||
|
||
if exist ..\wwwroot\package.json ( | ||
pushd ..\wwwroot | ||
echo npm install --production | ||
call npm install --production | ||
popd | ||
) | ||
|
||
for /d %%d in (..\wwwroot\*) do ( | ||
echo check %%d | ||
pushd %%d | ||
if exist package.json ( | ||
echo npm install --production | ||
call npm install --production | ||
) else ( | ||
echo no package.json found | ||
) | ||
popd | ||
) | ||
|
||
echo record deployment timestamp | ||
date /t >> ..\deployment.log | ||
time /t >> ..\deployment.log | ||
echo ---------------------- >> ..\deployment.log | ||
echo Deployment done | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@echo off | ||
setlocal | ||
rem ------------------------------------------------------------------------------------------ | ||
rem setupVsoRemoteRepo [remoteUser] [personalAccessToken] [projName{optional}] | ||
rem create and populate VSO git repo for the ABS code instance | ||
rem | ||
rem remoteUser: user account name of the personal access token | ||
rem personalAccessToken: the personal access token used to access github REST API (requires repos scope) | ||
rem projName the name of the project to create (default to WEBSITE_SITE_NAME) | ||
rem ------------------------------------------------------------------------------------------ | ||
set remoteUrl=https://api.github.com | ||
set remoteUser=%1 | ||
set remotePwd=%2 | ||
set projName=%3 | ||
if '%projName%'=='' set projName=%WEBSITE_SITE_NAME% | ||
set repoUrl=https://%remoteUser%:%remotePwd%@github.com/%remoteUser%/%projName%.git | ||
rem use curl to create project | ||
pushd ..\wwwroot | ||
type PostDeployScripts\githubProject.json.template | sed -e s/\{WEB_SITE_NAME\}/%projName%/g > %TEMP%\githubProject.json | ||
call curl -H "Content-Type: application/json" -u %remoteUser%:%remotePwd% -d "@%TEMP%\githubProject.json" -X POST %remoteUrl%/user/repos | ||
rem rm %TEMP%\githubProject.json | ||
popd | ||
|
||
popd | ||
rem cd to project root | ||
pushd ..\wwwroot | ||
|
||
rem init git | ||
call git init | ||
call git config user.name "%remoteUser%" | ||
call git config user.password "%remotePwd%" | ||
call git config user.email "[email protected]" | ||
call git add . | ||
call git commit -m "prepare to setup source control" | ||
call git push %repoUrl% master | ||
popd | ||
|
||
|
||
rem cleanup git stuff | ||
pushd ..\wwwroot | ||
call rm -r -f .git | ||
popd | ||
|
||
endlocal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@echo off | ||
setlocal | ||
rem ------------------------------------------------------------------------------------------ | ||
rem setupVsoRemoteRepo [vsoRemote] [vsoUserName] [vsoPersonalAccessToken] [projName{optional}] | ||
rem create and populate VSO git repo for the ABS code instance | ||
rem | ||
rem vsoRmote: url of the VSO site (e.g. https://awesomebot.visualstudio.com ) | ||
rem vosUserName: user account name of the personal access token | ||
rem vsoPersonalAccessToken: the personal access token used to access VSO REST api | ||
rem projName the name of the project to create (default to WEBSITE_SITE_NAME) | ||
rem ------------------------------------------------------------------------------------------ | ||
set remoteUrl=%1 | ||
set remoteUser=%2 | ||
set remotePwd=%3 | ||
set projName=%4 | ||
if '%projName%'=='' set projName=%WEBSITE_SITE_NAME% | ||
set vstsRoot=%remoteUrl% | ||
set repoUrl=https://%remoteUser%:%remotePwd%@%remoteUrl:~8%/_git/%projName% | ||
set vstsCreateProject=https://%remoteUser%:%remotePwd%@%remoteUrl:~8%/defaultcollection/_apis/projects?api-version=3.0 | ||
|
||
rem use curl to create project | ||
pushd ..\wwwroot | ||
type PostDeployScripts\vsoProject.json.template | sed -e s/\{WEB_SITE_NAME\}/%projName%/g > %TEMP%\vsoProject.json | ||
call curl -H "Content-Type: application/json" -d "@%TEMP%\vsoProject.json" -X POST %vstsCreateProject% | ||
rm %TEMP%\vsoProject.json | ||
rem sleep for 15 seconds for the creation to complete, this is a wild guess | ||
call sleep 15 | ||
popd | ||
|
||
popd | ||
rem cd to project root | ||
pushd ..\wwwroot | ||
|
||
rem init git | ||
call git init | ||
call git config user.name "%remoteUser%" | ||
call git config user.password "%remotePwd%" | ||
call git config user.email "[email protected]" | ||
call git add . | ||
call git commit -m "prepare to setup source control" | ||
call git push %repoUrl% master | ||
popd | ||
|
||
|
||
rem cleanup git stuff | ||
pushd ..\wwwroot | ||
call rm -r -f .git | ||
popd | ||
|
||
endlocal |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "{WEB_SITE_NAME}", | ||
"description": "{WEB_SITE_NAME} Azure Bot Service Code", | ||
"capabilities": { | ||
"versioncontrol": { | ||
"sourceControlType": "Git" | ||
}, | ||
"processTemplate": { | ||
"templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Use Azure app service editor | ||
|
||
1. make code change in the online editor | ||
|
||
Your code changes go live as the code changes are saved. | ||
|
||
## Use Visual Studio Code | ||
|
||
### Build and debug | ||
1. download source code zip and extract source in local folder | ||
2. open the source folder in Visual Studio Code | ||
3. make code changes | ||
4. download and run [botframework-emulator](https://emulator.botframework.com/) | ||
5. connect the emulator to http://localhost:3987 | ||
|
||
### Publish back | ||
|
||
``` | ||
npm run azure-publish | ||
``` | ||
|
||
## Use continuous integration | ||
|
||
If you have setup continuous integration, then your bot will automatically deployed when new changes are pushed to the source repository. | ||
|
||
|
||
|
Oops, something went wrong.