Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
* release/0.2.0: (22 commits)
  (GH-40) Added release notes link to communication
  (GH-34) Add ExternalNuGetFeed connected service input
  (GH-38) Add posting of messages to Gitter and Twitter
  (GH-36) Added default .gitattributes file
  (GH-33) Only build docs when something has changed
  (build) Switching to new syntax for Npm addin
  (build) Updated to latest addin
  (GH-32) Added npm install step
  (doc) Updated readme with link to docs
  (doc) Slight change to title
  (GH-31) Change WebLinkRoot
  (GH-31) Change theme and recipe
  (build) Remove diagnostic verbosity
  (build) Removed source files
  (build) let's try that again
  (build) Verbose logging
  (build) Fixing build
  (GH-31) Creating basic Wyam docs and build
  (GH-16) Publish vsix as artifact
  (GH-30) Moved everything to .github folder
  ...
  • Loading branch information
gep13 committed Dec 3, 2018
2 parents db46393 + 3c479e0 commit b381b4f
Show file tree
Hide file tree
Showing 19 changed files with 666 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ init:

# Build script
build_script:
- ps: .\build.ps1 -Target "AppVeyor"
- ps: .\build.ps1 -Target "AppVeyor" --settings_skipverification=true

# Tests
test: off
Expand Down
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Module version used:
* Operating System and PowerShell version:
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Module version used:
* Operating System and PowerShell version:
34 changes: 27 additions & 7 deletions Tasks/chocolatey/chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,37 @@ try {
{
[string]$pushOperation = Get-VstsInput -Name 'pushOperation' -Require
[string]$pushWorkingDirectory = Get-VstsInput -Name 'pushWorkingDirectory' -Require
[string]$pushSource = Get-VstsInput -Name 'pushSource' -Default 'https://push.chocolatey.org/'
[string]$pushApikey = Get-VstsInput -Name 'pushApikey'
[bool]$pushForce = Get-VstsInput -Name 'pushForce' -AsBool -Default $false
[string]$pushTimeout = Get-VstsInput -Name 'pushTimeout'
[string]$chocolateySourceType = Get-VstsInput -Name 'chocolateySourceType' -Require

if($pushSource) {
$chocolateyArguments.Add("--source=`"'$pushSource'`"") > $null
}
switch ( $chocolateySourceType )
{
"manual"
{
[string]$pushSource = Get-VstsInput -Name 'pushSource' -Default 'https://push.chocolatey.org/'
[string]$pushApikey = Get-VstsInput -Name 'pushApikey'

if($pushSource) {
$chocolateyArguments.Add("--source=`"'$pushSource'`"") > $null
}

if($pushApikey) {
$chocolateyArguments.Add("--apikey=`"'$pushApikey'`"") > $null
if($pushApikey) {
$chocolateyArguments.Add("--apikey=`"'$pushApikey'`"") > $null
}
}
"stored"
{
[string]$endPointGuid = Get-VstsInput -Name 'externalEndpoint' -Require
$endPoint = Get-VstsEndpoint $endPointGuid

if($endPoint.Auth.scheme -eq "None") {
$chocolateyArguments.Add("--source=`"'$($endPoint.Url)'`"") > $null
$chocolateyArguments.Add("--apikey=`"'$($endPoint.Auth.parameters.nugetkey)'`"") > $null
} else {
throw "This task does not support any schemes for External NuGet Feeds other than 'None'."
}
}
}

if($pushForce) {
Expand Down
28 changes: 26 additions & 2 deletions Tasks/chocolatey/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,28 @@
"visibleRule": "pushOperation=single",
"groupName": "pushOptions"
},
{
"name": "chocolateySourceType",
"type": "radio",
"label": "Source to push Chocolatey Packages to",
"required": true,
"defaultValue": "manual",
"helpMarkDown": "This can either be set directly in the Task definition, by setting the source and API Key, but by selecting pre-defined Chocolatey source from your Organisation settings.",
"options": {
"manual": "Manual configuration",
"stored": "Externally stored configuration"
},
"groupName": "pushOptions"
},
{
"name": "pushSource",
"type": "string",
"label": "Source",
"defaultValue": "https://push.chocolatey.org/",
"required": false,
"helpMarkDown": "The source to push the nupkg(s) to.",
"groupName": "pushOptions"
"groupName": "pushOptions",
"visibleRule": "chocolateySourceType = manual"
},
{
"name": "pushApikey",
Expand All @@ -442,7 +456,17 @@
"defaultValue": "",
"required": false,
"helpMarkDown": "The API Key that should be used to push the nupkg(s) to specified source.",
"groupName": "pushOptions"
"groupName": "pushOptions",
"visibleRule": "chocolateySourceType = manual"
},
{
"name": "externalEndpoint",
"type": "connectedService:ExternalNuGetFeed",
"label": "Chocolatey server",
"required": true,
"helpMarkDown": "The NuGet service connection that contains the external Chocolatey server’s credentials.",
"groupName": "pushOptions",
"visibleRule": "chocolateySourceType = stored"
},
{
"name": "pushForce",
Expand Down
65 changes: 62 additions & 3 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
// ADDINS
//////////////////////////////////////////////////////////////////////

#addin "nuget:?package=MagicChunks&version=1.1.0.34"
#addin "nuget:?package=MagicChunks&version=2.0.0.119"
#addin "nuget:?package=Cake.Tfx&version=0.4.2"
#addin "nuget:?package=Cake.Npm&version=0.7.2"
#addin "nuget:?package=Cake.Npm&version=0.10.0"
#addin "nuget:?package=Cake.AppVeyor&version=1.1.0.9"
#addin "nuget:?package=Cake.Wyam&version=1.7.4"
#addin "nuget:?package=Cake.Git&version=0.19.0"
#addin "nuget:?package=Cake.Kudu&version=0.8.0"
#addin "nuget:?package=Cake.Gitter&version=0.10.0"
#addin "nuget:?package=Cake.Twitter&version=0.9.0"

//////////////////////////////////////////////////////////////////////
// TOOLS
//////////////////////////////////////////////////////////////////////

#tool "nuget:?package=gitreleasemanager&version=0.7.1"
#tool "nuget:?package=GitVersion.CommandLine&version=3.6.4"
#tool "nuget:?package=Wyam&version=1.7.4"
#tool "nuget:?package=KuduSync.NET&version=1.4.0"

// Load other scripts.
#load "./build/parameters.cake"
#load "./build/wyam.cake"
#load "./build/gitter.cake"
#load "./build/twitter.cake"

//////////////////////////////////////////////////////////////////////
// PARAMETERS
Expand Down Expand Up @@ -50,6 +61,29 @@ Setup(context =>
parameters.IsTagged);
});

Teardown(context =>
{
Information("Starting Teardown...");

if(context.Successful)
{
if(!parameters.IsLocalBuild && !parameters.IsPullRequest && parameters.IsMasterRepo && (parameters.IsMasterBranch || ((parameters.IsReleaseBranch || parameters.IsHotFixBranch))) && parameters.IsTagged)
{
if(parameters.CanPostToTwitter)
{
SendMessageToTwitter();
}

if(parameters.CanPostToGitter)
{
SendMessageToGitterRoom();
}
}
}

Information("Finished running tasks.");
});

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Expand All @@ -60,10 +94,22 @@ Task("Clean")
CleanDirectories(new[] { "./build-results" });
});

Task("Npm-Install")
.Does(() =>
{
var settings = new NpmInstallSettings();
settings.LogLevel = NpmLogLevel.Silent;
NpmInstall(settings);
});

Task("Install-Tfx-Cli")
.Does(() =>
{
Npm.WithLogLevel(NpmLogLevel.Silent).FromPath(".").Install(settings => settings.Package("tfx-cli").Globally());
var settings = new NpmInstallSettings();
settings.Global = true;
settings.AddPackage("tfx-cli", "0.6.3");
settings.LogLevel = NpmLogLevel.Silent;
NpmInstall(settings);
});

Task("Create-Release-Notes")
Expand Down Expand Up @@ -105,6 +151,7 @@ Task("Update-Json-Versions")

Task("Package-Extension")
.IsDependentOn("Update-Json-Versions")
.IsDependentOn("Npm-Install")
.IsDependentOn("Install-Tfx-Cli")
.IsDependentOn("Clean")
.Does(() =>
Expand All @@ -118,6 +165,16 @@ Task("Package-Extension")
});
});

Task("Upload-AppVeyor-Artifacts")
.IsDependentOn("Package-Extension")
.WithCriteria(() => parameters.IsRunningOnAppVeyor)
.Does(() =>
{
var buildResultDir = Directory("./build-results");
var packageFile = File("gep13.chocolatey-azuredevops-" + parameters.Version.SemVersion + ".vsix");
AppVeyor.UploadArtifact(buildResultDir + packageFile);
});

Task("Publish-GitHub-Release")
.WithCriteria(() => parameters.ShouldPublish)
.Does(() =>
Expand Down Expand Up @@ -162,6 +219,8 @@ Task("Default")
.IsDependentOn("Package-Extension");

Task("Appveyor")
.IsDependentOn("Upload-AppVeyor-Artifacts")
.IsDependentOn("Publish-Documentation")
.IsDependentOn("Publish-Extension")
.IsDependentOn("Publish-GitHub-Release")
.Finally(() =>
Expand Down
29 changes: 29 additions & 0 deletions build/gitter.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
///////////////////////////////////////////////////////////////////////////////
// HELPER METHODS
///////////////////////////////////////////////////////////////////////////////

public void SendMessageToGitterRoom()
{
try
{
Information("Sending message to Gitter...");

var postMessageResult = Gitter.Chat.PostMessage(
message: parameters.GitterMessage,
messageSettings: new GitterChatMessageSettings { Token = parameters.Gitter.Token, RoomId = parameters.Gitter.RoomId}
);

if (postMessageResult.Ok)
{
Information("Message {0} successfully sent", postMessageResult.TimeStamp);
}
else
{
Error("Failed to send message: {0}", postMessageResult.Error);
}
}
catch(Exception ex)
{
Error("{0}", ex);
}
}
Loading

0 comments on commit b381b4f

Please sign in to comment.