Skip to content

Commit

Permalink
Update build process, fix bugs
Browse files Browse the repository at this point in the history
* Updated deploy process to include AppVeyor builds
* Added verbose switches to build stage functions
* Fixed bug in New-SlackMessage thanks to @kilasuit
* Fixed default token param in Find-SlackMessage
* Bump for !Deploy with !Verbose
  • Loading branch information
RamblingCookieMonster committed Jul 18, 2016
1 parent 10ef440 commit 8a4809f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 28 deletions.
5 changes: 4 additions & 1 deletion PSSlack/PSSlack.psd1
Expand Up @@ -4,7 +4,7 @@
RootModule = 'PSSlack.psm1'

# Version number of this module.
ModuleVersion = '0.0.11'
ModuleVersion = '0.0.12'

# ID used to uniquely identify this module
GUID = 'fb0a1f73-e16c-4829-b2a7-4fc8d7bed545'
Expand Down Expand Up @@ -109,3 +109,6 @@ PrivateData = @{
# DefaultCommandPrefix = ''

}



4 changes: 2 additions & 2 deletions PSSlack/Public/Find-SlackMessage.ps1
Expand Up @@ -57,7 +57,7 @@
[cmdletbinding()]
param (
[string]$Query,
$Token,
$Token = $Script:PSSlack.Token,
[validateset('asc','desc')]
$SortDirection = 'desc',
[validateset('score','timestamp')]
Expand All @@ -83,7 +83,7 @@
Body = $Body
Method = 'search.messages'
}
if($PSBoundParameters.ContainsKey('Token'))
if($Token)
{
$Params.Add('Token',$token)
}
Expand Down
2 changes: 1 addition & 1 deletion PSSlack/Public/New-SlackMessage.ps1
Expand Up @@ -204,7 +204,7 @@
'channel' { $body.channel = $Channel}
'text' { $body.text = $text}
'username' { $body.username = $username}
'as_user' { $body.asuser = $AsUser}
'asuser' { $body.as_user = $AsUser}
'iconurl' { $body.icon_url = $iconurl}
'iconemoji' { $body.icon_emoji = $iconemoji}
'linknames' { $body.link_names = 1}
Expand Down
35 changes: 32 additions & 3 deletions deploy.psdeploy.ps1
Expand Up @@ -13,9 +13,13 @@

# Set-BuildEnvironment from BuildHelpers module has populated ENV:BHProjectName

# find a folder that has psd1 of same name...

if($ENV:BHProjectName -and $ENV:BHProjectName.Count -eq 1)
# Publish to gallery with a few restrictions
if(
$env:BHProjectName -and $env:BHProjectName.Count -eq 1 -and
$env:BHBuildSystem -ne 'Unknown' -and
$env:BHBranchName -eq "master" -and
$env:BHCommitMessage -match '!deploy'
)
{
Deploy Module {
By PSGalleryModule {
Expand All @@ -26,4 +30,29 @@ if($ENV:BHProjectName -and $ENV:BHProjectName.Count -eq 1)
}
}
}
}
else
{
"Skipping deployment: To deploy, ensure that...`n" +
"`t* You are in a known build system (Current: $ENV:BHBuildSystem)`n" +
"`t* You are committing to the master branch (Current: $ENV:BHBranchName) `n" +
"`t* Your commit message includes !deploy (Current: $ENV:BHCommitMessage)" |
Write-Host
}

# Publish to AppVeyor if we're in AppVeyor
if(
$env:BHProjectName -and $ENV:BHProjectName.Count -eq 1 -and
$env:BHBuildSystem -eq 'AppVeyor'
)
{
Deploy DeveloperBuild {
By AppVeyorModule {
FromSource $ENV:BHProjectName
To AppVeyor
WithOptions @{
Version = $env:APPVEYOR_BUILD_VERSION
}
}
}
}
32 changes: 11 additions & 21 deletions psake.ps1
Expand Up @@ -58,31 +58,21 @@ Task Test -Depends Init {

Task Build -Depends Test {
$lines
#Set-ModuleFunctions

# Load the module, read the exported functions, update the psd1 FunctionsToExport
Set-ModuleFunctions @Verbose

# Bump the module version
Update-Metadata @Verbose -Path $env:BHPSModuleManifest
}

Task Deploy -Depends Build {
$lines

# Gate deployment
if(
$ENV:BHBuildSystem -ne 'Unknown' -and
$ENV:BHBranchName -eq "master" -and
$ENV:BHCommitMessage -match '!deploy'
)
{
$Params = @{
Path = $ProjectRoot
Force = $true
}

Invoke-PSDeploy @Verbose @Params
}
else
{
"Skipping deployment: To deploy, ensure that...`n" +
"`t* You are in a known build system (Current: $ENV:BHBuildSystem)`n" +
"`t* You are committing to the master branch (Current: $ENV:BHBranchName) `n" +
"`t* Your commit message includes !deploy (Current: $ENV:BHCommitMessage)"
$Params = @{
Path = $ProjectRoot
Force = $true
Recurse = $false # We keep psdeploy artifacts, avoid deploying those : )
}
Invoke-PSDeploy @Verbose @Params
}

0 comments on commit 8a4809f

Please sign in to comment.