-
Notifications
You must be signed in to change notification settings - Fork 177
Build/continuous deployment #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b6b0176
Added support for a fully automated deployment environment
seesharper a5ea477
Added api keys to appveyor.yml
seesharper 18d2e8c
Fixed path to test project
seesharper 9bbc24b
Added choco push command
seesharper bc68d3f
Fixed artifacts pattern in Appveyor.yml
seesharper 0800401
Updated to Dotnet.Build 0.2.8
seesharper c342635
updated secrets with encrypted values
filipw 9a403ae
Use global variables in BuildContext.csx
seesharper 8da36ae
Removed public static from global variables
seesharper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
version: 1.0.{build} | ||
image: Visual Studio 2017 | ||
|
||
install: | ||
- cmd: choco install dotnet.script | ||
|
||
build_script: | ||
- ps: >- | ||
cd .\build\ | ||
- cmd: >- | ||
cd build | ||
|
||
.\install-dotnet-script.ps1 | ||
- cmd: | ||
dotnet .\dotnet-script\dotnet-script.dll build.csx | ||
refreshenv | ||
|
||
dotnet script build.csx | ||
|
||
test: off | ||
artifacts: | ||
- path: /**/Dotnet.Script*.nupkg | ||
- path: build\Artifacts\Chocolatey\*.nupkg | ||
name: Chocolatey Packages | ||
# Uncomment this to enable deploy on repo tagging | ||
# deploy: | ||
# provider: Chocolatey | ||
# api_key: | ||
# secure: [Your API key goes here] | ||
# skip_symbols: false | ||
# artifact: /.*\.nupkg/ | ||
# on: | ||
# appveyor_repo_tag: true | ||
|
||
- path: build\Artifacts\NuGet\*.nupkg | ||
name: NuGet Packages | ||
|
||
- path: build\Artifacts\GitHub\*.zip | ||
name: GitHub | ||
|
||
test: off | ||
environment: | ||
IS_SECURE_BUILDENVIRONMENT: | ||
secure: xU2zj54rFEPVqg/UuGU/DA== | ||
GITHUB_REPO_TOKEN: | ||
secure: AzNlvlKMzcoPNzawN3Hv48N6dzPa0N57HdFfAXP2cELBp9uiwJxtLdKWuDhZyf21 | ||
NUGET_APIKEY: | ||
secure: 81vsB74sZV0IlV1Ru/qKPbaDS47lQ80aeOLWCPmlvak7O/RA9EqqFqWVxZFS0ora | ||
CHOCO_APIKEY: | ||
secure: scd8oB50KqKDRvt/+TSgUJavZzY39iqqa+1AZmj1CGue1/vjWJn6vIO4sMhN+d2l |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,49 @@ | ||
#! "netcoreapp2.0" | ||
#r "nuget:NetStandard.Library,2.0.0" | ||
#r "nuget:Microsoft.DotNet.PlatformAbstractions, 2.0.3" | ||
#load "DotNet.csx" | ||
#load "nuget:Dotnet.Build, 0.2.8" | ||
#load "nuget:github-changelog, 0.1.4" | ||
#load "Choco.csx" | ||
#load "NuGet.csx" | ||
#load "FileUtils.csx" | ||
#load "BuildContext.csx" | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
|
||
var currentFolder = Path.GetDirectoryName(GetScriptPath()); | ||
var root = Path.GetFullPath(Path.Combine(currentFolder, "..")); | ||
|
||
|
||
DotNet.Build(Path.Combine(root, "src","Dotnet.Script")); | ||
|
||
DotNet.Test($"{root}/src/Dotnet.Script.Tests"); | ||
using static ReleaseManagement; | ||
using static ChangeLog; | ||
using static FileUtils; | ||
|
||
DotNet.Build(DotnetScriptProjectFolder); | ||
DotNet.Test(TestProjectFolder); | ||
DotNet.Publish(DotnetScriptProjectFolder, PublishArtifactsFolder); | ||
|
||
// We only publish packages from Windows/AppVeyor | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
if (BuildEnvironment.IsWindows) | ||
{ | ||
string packagesOutputFolder = Path.Combine(root, "build", "NuGet"); | ||
DotNet.Pack(Path.Combine(root, "src" , "Dotnet.Script"), packagesOutputFolder); | ||
DotNet.Pack(Path.Combine(root, "src" , "Dotnet.Script.Core"), packagesOutputFolder); | ||
DotNet.Pack(Path.Combine(root, "src" , "Dotnet.Script.DependencyModel"), packagesOutputFolder); | ||
DotNet.Pack(Path.Combine(root, "src" , "Dotnet.Script.DependencyModel.NuGet"), packagesOutputFolder); | ||
DotNet.Publish($"{root}/src/Dotnet.Script"); | ||
Choco.Pack($"{root}/src/Dotnet.Script","Chocolatey"); | ||
DotNet.Pack(DotnetScriptProjectFolder, NuGetArtifactsFolder); | ||
DotNet.Pack(DotnetScriptCoreProjectFolder, NuGetArtifactsFolder); | ||
DotNet.Pack(DotnetScriptDependencyModelProjectFolder, NuGetArtifactsFolder); | ||
DotNet.Pack(DotnetScriptDependencyModelNuGetProjectFolder, NuGetArtifactsFolder); | ||
Choco.Pack(DotnetScriptProjectFolder, PublishArtifactsFolder, ChocolateyArtifactsFolder); | ||
Zip(PublishArchiveFolder, PathToGitHubReleaseAsset); | ||
|
||
|
||
if (BuildEnvironment.IsSecure) | ||
{ | ||
await CreateReleaseNotes(); | ||
|
||
if (Git.Default.IsTagCommit()) | ||
{ | ||
Git.Default.RequreCleanWorkingTree(); | ||
await ReleaseManagerFor(Owner,ProjectName,BuildEnvironment.GitHubAccessToken) | ||
.CreateRelease(Git.Default.GetLatestTag(), PathToReleaseNotes, new [] { new ZipReleaseAsset(PathToGitHubReleaseAsset) }); | ||
NuGet.TryPush(NuGetArtifactsFolder); | ||
} | ||
} | ||
} | ||
|
||
|
||
private async Task CreateReleaseNotes() | ||
{ | ||
Logger.Log("Creating release notes"); | ||
var generator = ChangeLogFrom(Owner, ProjectName, BuildEnvironment.GitHubAccessToken).SinceLatestTag(); | ||
if (!Git.Default.IsTagCommit()) | ||
{ | ||
generator = generator.IncludeUnreleased(); | ||
} | ||
await generator.Generate(PathToReleaseNotes); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#load "nuget:Dotnet.Build, 0.2.8" | ||
using static FileUtils; | ||
using System.Xml.Linq; | ||
|
||
string Version; | ||
|
||
string GitHubArtifactsFolder; | ||
|
||
string GitHubReleaseAsset; | ||
|
||
string GitHubReleaseNoteAsset; | ||
|
||
string NuGetArtifactsFolder; | ||
|
||
string ChocolateyArtifactsFolder; | ||
|
||
string PublishArtifactsFolder; | ||
|
||
string PublishArchiveFolder; | ||
|
||
string DotnetScriptProjectFolder; | ||
|
||
string DotnetScriptCoreProjectFolder; | ||
|
||
string DotnetScriptDependencyModelProjectFolder; | ||
|
||
string DotnetScriptDependencyModelNuGetProjectFolder; | ||
|
||
string Root; | ||
|
||
string TestProjectFolder; | ||
|
||
string PathToReleaseNotes; | ||
|
||
string PathToGitHubReleaseAsset; | ||
|
||
string Owner; | ||
|
||
string ProjectName; | ||
|
||
Owner = "filipw"; | ||
ProjectName = "dotnet-script"; | ||
Root = FileUtils.GetScriptFolder(); | ||
|
||
DotnetScriptProjectFolder = Path.Combine(Root, "..", "src", "Dotnet.Script"); | ||
DotnetScriptCoreProjectFolder = Path.Combine(Root, "..", "src", "Dotnet.Script.Core"); | ||
DotnetScriptDependencyModelProjectFolder = Path.Combine(Root, "..", "src", "Dotnet.Script.DependencyModel"); | ||
DotnetScriptDependencyModelNuGetProjectFolder = Path.Combine(Root, "..", "src", "Dotnet.Script.DependencyModel.NuGet"); | ||
TestProjectFolder = Path.Combine(Root, "..", "src", "Dotnet.Script.Tests"); | ||
|
||
var artifactsFolder = CreateDirectory(Root, "Artifacts"); | ||
GitHubArtifactsFolder = CreateDirectory(artifactsFolder, "GitHub"); | ||
NuGetArtifactsFolder = CreateDirectory(artifactsFolder, "NuGet"); | ||
ChocolateyArtifactsFolder = CreateDirectory(artifactsFolder, "Chocolatey"); | ||
PublishArtifactsFolder = CreateDirectory(artifactsFolder, "Publish", ProjectName); | ||
PublishArchiveFolder = Path.Combine(PublishArtifactsFolder, ".."); | ||
|
||
PathToReleaseNotes = Path.Combine(GitHubArtifactsFolder, "ReleaseNotes.md"); | ||
|
||
Version = ReadVersion(); | ||
|
||
PathToGitHubReleaseAsset = Path.Combine(GitHubArtifactsFolder, $"{ProjectName}.{Version}.zip"); | ||
|
||
string ReadVersion() | ||
{ | ||
var projectFile = XDocument.Load(Directory.GetFiles(DotnetScriptProjectFolder, "*.csproj").Single()); | ||
var versionPrefix = projectFile.Descendants("VersionPrefix").SingleOrDefault()?.Value; | ||
var versionSuffix = projectFile.Descendants("VersionSuffix").SingleOrDefault()?.Value; | ||
|
||
if (versionSuffix != null) | ||
{ | ||
return $"{versionPrefix}-{versionSuffix}"; | ||
} | ||
else | ||
{ | ||
return versionPrefix; | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏆