Skip to content

Commit

Permalink
ci: dogfooding github release (#14)
Browse files Browse the repository at this point in the history
* ci: replace deployment with lib function

* chore: add final newline
  • Loading branch information
ArwynFr authored Oct 3, 2024
1 parent 706f021 commit d520c81
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 26 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ indent_style = space

[*.{ps1,psd1,psm1}]
indent_size = 2
insert_final_newline = true
2 changes: 1 addition & 1 deletion ArwynFr.SemanticVersion/ArwynFr.SemanticVersion.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
'New-GithubSemanticVersionRelease'
'Step-SemanticVersion'
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
ModuleVersion = '0.0.0'
RootModule = 'ConvertTo-SemanticVersionStep.psm1'
FunctionsToExport = @( 'ConvertTo-SemanticVersionStep' )
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ function ConvertTo-SemanticVersionStep {
Default { 'patch' }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
ModuleVersion = '0.0.0'
RootModule = 'Step-SemanticVersion.psm1'
FunctionsToExport = @( 'Step-SemanticVersion' )
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ function Step-SemanticVersion {

return [semver]::new($Version.Major, $Version.Minor, $Version.Patch + 1, $PreRelease, $Build)
}
}
}
20 changes: 2 additions & 18 deletions build/Start-Deployment.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
[CmdletBinding(SupportsShouldProcess)]
param ()


Import-Module ArwynFr.SemanticVersion -Force
$RootPath = Join-Path $PSScriptRoot .. | Convert-Path
$ModulePath = Join-Path $RootPath ArwynFr.SemanticVersion

Import-Module $ModulePath -Force
$CurrentVersion = (gh release view --json tagName | ConvertFrom-Json).tagName
$CommitMessage = [string] (git log -1 --pretty=%B)
$Increment = $CommitMessage | ConvertTo-SemanticVersionStep
$TargetVersion = $CurrentVersion | Step-SemanticVersion -BumpType $Increment -PreRelease $PreRelease

"Increment = $Increment" | Write-Verbose
"CurrentVersion = $CurrentVersion" | Write-Verbose
"TargetVersion = $TargetVersion" | Write-Verbose
$TargetVersion = New-GithubSemanticVersionRelease -WhatIf:$WhatIfPreference -AddTags

Get-ChildItem $ModulePath -Recurse -Filter *.psd1 | ForEach-Object {
Update-ModuleManifest -ModuleVersion $TargetVersion -Path $_ -WhatIf:$WhatIfPreference
}

Publish-Module -Path $ModulePath -NuGetApiKey $env:PSGALLERY_APIKEY -WhatIf:$WhatIfPreference

if ($PSCmdlet.ShouldProcess($TargetVersion, 'gh release create')) {
gh release create $TargetVersion --generate-notes
git tag --force "v$($TargetVersion.Major).$($TargetVersion.Minor)"
git tag --force "v$($TargetVersion.Major)"
git push origin --tags --force
}
2 changes: 1 addition & 1 deletion build/Start-Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ $configuration = [PesterConfiguration]@{
}
}

Invoke-Pester -Configuration $configuration
Invoke-Pester -Configuration $configuration
2 changes: 1 addition & 1 deletion tests/ConvertTo-SemanticVersionStep.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ InModuleScope ArwynFr.SemanticVersion {
}
}
}
}
}
2 changes: 1 addition & 1 deletion tests/Step-SemanticVersion.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ InModuleScope ArwynFr.SemanticVersion {
}
}
}
}
}

0 comments on commit d520c81

Please sign in to comment.