Skip to content
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

Splatter 0.5.4 #17

Merged
merged 42 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
cdf1a0e
Updating build and adding new Splatter logo (Fixes #12)
May 8, 2023
fcedadf
Updating build and adding new Splatter logo (Fixes #12)
May 8, 2023
7e759ae
Updating build and adding new Splatter logo (Fixes #12)
May 8, 2023
e958abe
Updating build and adding new Splatter logo (Fixes #12)
May 8, 2023
282068e
Fixing Assets directory case (re #12)
May 8, 2023
c5bacdc
Fixing Assets directory case (re #12)
May 8, 2023
095f661
Fixing Assets directory case (re #12)
May 8, 2023
457cd7a
Fixing Assets directory case (re #12)
May 8, 2023
4074ec8
Get-Splat - Coercing all dictionaries into [Ordered] PSCustomObjects …
May 8, 2023
44916b9
Splatter Logo - falling back to cursive font-family (re #12)
May 8, 2023
d5e428f
Splatter Logo - falling back to cursive font-family (re #12)
May 8, 2023
79a72d3
Splatter Logo - falling back to cursive font-family (re #12)
May 8, 2023
6afd581
Splatter Logo - falling back to cursive font-family (re #12)
May 8, 2023
344582f
Splatter Logo - reducing font size (re #12)
May 8, 2023
0ae1ca5
Splatter Logo - reducing font size (re #12)
May 8, 2023
960a0a9
Splatter Logo - reducing font size (re #12)
May 8, 2023
96fa37d
Splatter Logo - Adjusting Chevron Position (re #12)
May 8, 2023
d5ed952
Splatter Logo - Adjusting Chevron Position (re #12)
May 8, 2023
cb690d3
Splatter Logo - Adjusting Chevron Position (re #12)
May 8, 2023
46e63aa
Adding Splatter.png (Fixes #12)
May 8, 2023
92b8df1
Updating Logo in README (Fixes #12)
May 8, 2023
5eb978e
Updating Logo in README (Fixes #12)
May 8, 2023
3320254
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
d02624b
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
b6ec0f1
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
28268da
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
d831997
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
39537ae
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
0a71840
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
b28050b
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
b49775f
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
5b798b0
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
c051ce7
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
3041861
Adding Splatter.HelpOut.ps1 (Fixes #14)
May 8, 2023
16c3f88
Updating splatter workflow (minifying) (Fixes #15)
May 8, 2023
19e5850
Updating splatter workflow (minifying and checking in) (Fixes #15)
May 8, 2023
222c43b
Updating splatter workflow (not minifying) (re #15)
May 8, 2023
4cdecb8
Adding Splatter aliases to definitions (Fixes #16)
May 9, 2023
437d563
Adding Splatter aliases to definitions (Fixes #16)
May 9, 2023
7149925
Updating Module Version [0.5.4] and CHANGELOG
May 9, 2023
f3a2ee2
Updating Module Version [0.5.4] and CHANGELOG
May 9, 2023
6e5e545
Moving Splatter.PSSVG.ps1 into /Build (re #12)
May 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 159 additions & 35 deletions .github/workflows/TestBuildAndPublish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

name: Test Build And Publish

name: Analyze, Test, Tag, and Publish
on:
workflow_dispatch:
push:
pull_request:
workflow_dispatch:
jobs:
PowerShellStaticAnalysis:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -124,6 +125,8 @@ jobs:
$Parameters = @{}
$Parameters.ModulePath = ${env:ModulePath}
$Parameters.PesterMaxVersion = ${env:PesterMaxVersion}
$Parameters.NoCoverage = ${env:NoCoverage}
$Parameters.NoCoverage = $parameters.NoCoverage -match 'true';
foreach ($k in @($parameters.Keys)) {
if ([String]::IsNullOrEmpty($parameters[$k])) {
$parameters.Remove($k)
Expand All @@ -142,7 +145,11 @@ jobs:
$ModulePath,
# The Pester max version. By default, this is pinned to 4.99.99.
[string]
$PesterMaxVersion = '4.99.99'
$PesterMaxVersion = '4.99.99',

# If set, will not collect code coverage.
[switch]
$NoCoverage
)

$global:ErrorActionPreference = 'continue'
Expand All @@ -154,11 +161,18 @@ jobs:
$importedModule = Import-Module $ModulePath -Force -PassThru
$importedPester, $importedModule | Out-Host

$codeCoverageParameters = @{
CodeCoverage = "$($importedModule | Split-Path)\*-*.ps1"
CodeCoverageOutputFile = ".\$moduleName.Coverage.xml"
}

if ($NoCoverage) {
$codeCoverageParameters = @{}
}


$result =
Invoke-Pester -PassThru -Verbose -OutputFile ".\$moduleName.TestResults.xml" -OutputFormat NUnitXml `
-CodeCoverage "$($importedModule | Split-Path)\*-*.ps1" -CodeCoverageOutputFile ".\$moduleName.Coverage.xml"
Invoke-Pester -PassThru -Verbose -OutputFile ".\$moduleName.TestResults.xml" -OutputFormat NUnitXml @codeCoverageParameters

"::set-output name=TotalCount::$($result.TotalCount)",
"::set-output name=PassedCount::$($result.PassedCount)",
Expand Down Expand Up @@ -238,7 +252,7 @@ jobs:

if (-not ($gitHubEvent.head_commit.message -match "Merge Pull Request #(?<PRNumber>\d+)") -and
(-not $gitHubEvent.psobject.properties['inputs'])) {
"::warning::Pull Request has not merged, skipping" | Out-Host
"::warning::Pull Request has not merged, skipping Tagging" | Out-Host
return
}

Expand Down Expand Up @@ -291,6 +305,9 @@ jobs:
$Parameters.UserEmail = ${env:UserEmail}
$Parameters.UserName = ${env:UserName}
$Parameters.TagVersionFormat = ${env:TagVersionFormat}
$Parameters.ReleaseNameFormat = ${env:ReleaseNameFormat}
$Parameters.ReleaseAsset = ${env:ReleaseAsset}
$Parameters.ReleaseAsset = $parameters.ReleaseAsset -split ';' -replace '^[''"]' -replace '[''"]$'
foreach ($k in @($parameters.Keys)) {
if ([String]::IsNullOrEmpty($parameters[$k])) {
$parameters.Remove($k)
Expand All @@ -312,7 +329,15 @@ jobs:
# The tag version format (default value: 'v$(imported.Version)')
# This can expand variables. $imported will contain the imported module.
[string]
$TagVersionFormat = 'v$($imported.Version)'
$TagVersionFormat = 'v$($imported.Version)',

# The release name format (default value: '$($imported.Name) $($imported.Version)')
[string]
$ReleaseNameFormat = '$($imported.Name) $($imported.Version)',

# Any assets to attach to the release. Can be a wildcard or file name.
[string[]]
$ReleaseAsset
)


Expand All @@ -329,7 +354,7 @@ jobs:

if (-not ($gitHubEvent.head_commit.message -match "Merge Pull Request #(?<PRNumber>\d+)") -and
(-not $gitHubEvent.psobject.properties['inputs'])) {
"::warning::Pull Request has not merged, skipping" | Out-Host
"::warning::Pull Request has not merged, skipping GitHub release" | Out-Host
return
}

Expand All @@ -348,6 +373,7 @@ jobs:
$targetVersion =$ExecutionContext.InvokeCommand.ExpandString($TagVersionFormat)
$targetReleaseName = $targetVersion
$releasesURL = 'https://api.github.com/repos/${{github.repository}}/releases'
"Release URL: $releasesURL" | Out-Host
$listOfReleases = Invoke-RestMethod -Uri $releasesURL -Method Get -Headers @{
"Accept" = "application/vnd.github.v3+json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
Expand All @@ -357,39 +383,89 @@ jobs:

if ($releaseExists) {
"::warning::Release '$($releaseExists.Name )' Already Exists" | Out-Host
return
$releasedIt = $releaseExists
} else {
$releasedIt = Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
[Ordered]@{
owner = '${{github.owner}}'
repo = '${{github.repository}}'
tag_name = $targetVersion
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
body =
if ($env:RELEASENOTES) {
$env:RELEASENOTES
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
$imported.PrivateData.PSData.ReleaseNotes
} else {
"$($imported.Name) $targetVersion"
}
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
} | ConvertTo-Json
) -Headers @{
"Accept" = "application/vnd.github.v3+json"
"Content-type" = "application/json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
}
}


Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
[Ordered]@{
owner = '${{github.owner}}'
repo = '${{github.repository}}'
tag_name = $targetVersion
name = "$($imported.Name) $targetVersion"
body =
if ($env:RELEASENOTES) {
$env:RELEASENOTES
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
$imported.PrivateData.PSData.ReleaseNotes
} else {
"$($imported.Name) $targetVersion"



if (-not $releasedIt) {
throw "Release failed"
} else {
$releasedIt | Out-Host
}

$releaseUploadUrl = $releasedIt.upload_url -replace '\{.+$'

if ($ReleaseAsset) {
$fileList = Get-ChildItem -Recurse
$filesToRelease =
@(:nextFile foreach ($file in $fileList) {
foreach ($relAsset in $ReleaseAsset) {
if ($relAsset -match '[\*\?]') {
if ($file.Name -like $relAsset) {
$file; continue nextFile
}
} elseif ($file.Name -eq $relAsset -or $file.FullName -eq $relAsset) {
$file; continue nextFile
}
}
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
} | ConvertTo-Json
) -Headers @{
"Accept" = "application/vnd.github.v3+json"
"Content-type" = "application/json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
})

$releasedFiles = @{}
foreach ($file in $filesToRelease) {
if ($releasedFiles[$file.Name]) {
Write-Warning "Already attached file $($file.Name)"
continue
} else {
$fileBytes = [IO.File]::ReadAllBytes($file.FullName)
$releasedFiles[$file.Name] =
Invoke-RestMethod -Uri "${releaseUploadUrl}?name=$($file.Name)" -Headers @{
"Accept" = "application/vnd.github+json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
} -Body $fileBytes -ContentType Application/octet-stream
$releasedFiles[$file.Name]
}
}

"Attached $($releasedFiles.Count) file(s) to release" | Out-Host
}



} @Parameters
- name: PublishPowerShellGallery
id: PublishPowerShellGallery
shell: pwsh
run: |
$Parameters = @{}
$Parameters.ModulePath = ${env:ModulePath}
$Parameters.Exclude = ${env:Exclude}
$Parameters.Exclude = $parameters.Exclude -split ';' -replace '^[''"]' -replace '[''"]$'
foreach ($k in @($parameters.Keys)) {
if ([String]::IsNullOrEmpty($parameters[$k])) {
$parameters.Remove($k)
Expand All @@ -398,22 +474,36 @@ jobs:
Write-Host "::debug:: PublishPowerShellGallery $(@(foreach ($p in $Parameters.GetEnumerator()) {'-' + $p.Key + ' ' + $p.Value}) -join ' ')"
& {param(
[string]
$ModulePath
$ModulePath,

[string[]]
$Exclude = @('*.png', '*.mp4', '*.jpg','*.jpeg', '*.gif', 'docs[/\]*')
)

$gitHubEvent = if ($env:GITHUB_EVENT_PATH) {
[IO.File]::ReadAllText($env:GITHUB_EVENT_PATH) | ConvertFrom-Json
} else { $null }

if (-not $Exclude) {
$Exclude = @('*.png', '*.mp4', '*.jpg','*.jpeg', '*.gif','docs[/\]*')
}


@"
::group::GitHubEvent
$($gitHubEvent | ConvertTo-Json -Depth 100)
::endgroup::
"@ | Out-Host

@"
::group::PSBoundParameters
$($PSBoundParameters | ConvertTo-Json -Depth 100)
::endgroup::
"@ | Out-Host

if (-not ($gitHubEvent.head_commit.message -match "Merge Pull Request #(?<PRNumber>\d+)") -and
(-not $gitHubEvent.psobject.properties['inputs'])) {
"::warning::Pull Request has not merged, skipping" | Out-Host
"::warning::Pull Request has not merged, skipping Gallery Publish" | Out-Host
return
}

Expand All @@ -428,9 +518,9 @@ jobs:

if (-not $imported) { return }

$foundModule = try { Find-Module -Name $imported.Name -ErrorAction SilentlyContinue } catch {}
$foundModule = try { Find-Module -Name $imported.Name -ErrorAction SilentlyContinue} catch {}

if ($foundModule -and $foundModule.Version -ge $imported.Version) {
if ($foundModule -and (([Version]$foundModule.Version) -ge ([Version]$imported.Version))) {
"::warning::Gallery Version of $moduleName is more recent ($($foundModule.Version) >= $($imported.Version))" | Out-Host
} else {

Expand All @@ -453,9 +543,24 @@ jobs:
if (Test-Path $moduleGitPath) {
Remove-Item -Recurse -Force $moduleGitPath
}

if ($Exclude) {
"::notice::Attempting to Exlcude $exclude" | Out-Host
Get-ChildItem $moduleTempPath -Recurse |
Where-Object {
foreach ($ex in $exclude) {
if ($_.FullName -like $ex) {
"::notice::Excluding $($_.FullName)" | Out-Host
return $true
}
}
} |
Remove-Item
}

Write-Host "Module Files:"
Get-ChildItem $moduleTempPath -Recurse
Write-Host "Publishing $moduleName [$($imported.Version)] to Gallery"
Write-Host "Publishing $moduleName [$($imported.Version)] to Gallery"
Publish-Module -Path $moduleTempPath -NuGetApiKey $gk
if ($?) {
Write-Host "Published to Gallery"
Expand All @@ -465,4 +570,23 @@ jobs:
}
}
} @Parameters
BuildSplatter:
runs-on: ubuntu-latest
if: ${{ success() }}
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: GitLogger
uses: GitLogging/GitLoggerAction@main
id: GitLogger
- name: Use PSSVG Action
uses: StartAutomating/PSSVG@main
id: PSSVG
- name: BuildPipeScript
uses: StartAutomating/PipeScript@main
- name: UseEZOut
uses: StartAutomating/EZOut@master
- name: Run HelpOut
uses: StartAutomating/HelpOut@master
id: HelpOut

Binary file removed Assets/Splatter-16x9.png
Binary file not shown.
Binary file modified Assets/Splatter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions Assets/Splatter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions Assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions Build/Splatter.GitHubWorkflow.PSDevOps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#requires -Module PSDevOps
Import-BuildStep -ModuleName Splatter
Push-Location ($PSScriptRoot | Split-Path)
New-GitHubWorkflow -Name "Analyze, Test, Tag, and Publish" -On Push, PullRequest, Demand -Job PowerShellStaticAnalysis,
TestPowerShellOnLinux,
TagReleaseAndPublish,
BuildSplatter -OutputPath .\.github\workflows\TestBuildAndPublish.yml
Pop-Location
16 changes: 16 additions & 0 deletions Build/Splatter.HelpOut.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#require -Module HelpOut
Push-Location ($PSScriptRoot | Split-Path)

$SplatterLoaded = Get-Module Splatter
if (-not $SplatterLoaded) {
$SplatterLoaded = Get-ChildItem -Recurse -Filter "*.psd1" | Where-Object Name -like 'Splatter*' | Import-Module -Name { $_.FullName } -Force -PassThru
}
if ($SplatterLoaded) {
"::notice title=ModuleLoaded::Splatter Loaded" | Out-Host
} else {
"::error:: Splatter not loaded" |Out-Host
}

Save-MarkdownHelp -Module Splatter -SkipCommandType Alias -PassThru

Pop-Location
Loading