Last active
March 6, 2018 13:31
-
-
Save GeorgDangl/d69fd27941f563848d4d06f215fe3063 to your computer and use it in GitHub Desktop.
Using Microsoft WebDeploy with NUKE build, see https://blog.dangl.me/archive/using-webdeploy-via-nuke-build-scripts/
This file contains hidden or 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
class Build : NukeBuild | |
{ | |
[Parameter] readonly string Environment; | |
[Parameter] readonly string WebDeployUsername; | |
[Parameter] readonly string WebDeployPassword; | |
[Parameter] readonly string WebDeployPublishUrl; | |
[Parameter] readonly string WebDeploySiteName; | |
Target Publish => _ => _ | |
.Requires(() => Environment) | |
.DependsOn(FrontendRestore) | |
.DependsOn(BackendRestore) | |
.DependsOn(FrontendCompile) | |
.Executes(() => | |
{ | |
DotNetPublish(p => | |
{ | |
return p.SetWorkingDirectory(SourceDirectory / "project_name") | |
.SetConfiguration(Environment) | |
.SetOutput(OutputDirectory); | |
}); | |
}); | |
Target Deploy => _ => _ | |
.DependsOn(Publish) | |
.Requires(() => WebDeployUsername) | |
.Requires(() => WebDeployPassword) | |
.Requires(() => WebDeployPublishUrl) | |
.Requires(() => WebDeploySiteName) | |
.Executes(() => | |
{ | |
WebDeploy(s => | |
{ | |
return s.SetSourcePath(OutputDirectory) | |
.SetUsername(WebDeployUsername) | |
.SetPassword(WebDeployPassword) | |
.SetEnableAppOfflineRule(true) | |
.SetPublishUrl(WebDeployPublishUrl) | |
.SetSiteName(WebDeploySiteName); | |
}); | |
}); | |
} |
This file contains hidden or 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
./build.ps1 -target Deploy ` | |
-Environment 'Staging' ` | |
-WebDeployUsername '$appname' ` | |
-WebDeployPassword 'password' ` | |
-WebDeployPublishUrl 'https://appname.scm.azurewebsites.net:443/msdeploy.axd?site=appname' ` | |
-WebDeploySiteName 'appname' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment