-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat+: rewrite to be semver compliant (#5)
* feat: rewrite to be semver compliant * fix: add import module pester * fix: add missing output type
- Loading branch information
Showing
19 changed files
with
171 additions
and
283 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file contains 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,36 @@ | ||
= StepSemVer | ||
|
||
StepSemVer is a small powershell module that adds a command to increment semantic version numbers. | ||
|
||
image:https://img.shields.io/powershellgallery/v/StepSemVer?style=for-the-badge[PowerShell Gallery] image:https://img.shields.io/powershellgallery/dt/StepSemVer?style=for-the-badge[PowerShell Gallery] | ||
|
||
== Rules and standards | ||
|
||
The following documents provide additional information on rules and standards applying to this project : | ||
|
||
- link:/LICENSE[MIT License] | ||
|
||
== How to use the module | ||
|
||
This module contains a single command : | ||
|
||
=== Step-SemVer | ||
|
||
Returns a semantic version that increments an existing value. | ||
|
||
```Powershell | ||
Step-SemVer | ||
[[-Version] <semver>] | ||
[-BumpType] {major | minor | patch} | ||
[[-PreRelease] <string>] | ||
[[-Build] <string>] | ||
[<CommonParameters>] | ||
``` | ||
|
||
`-Version`:: *Required* and *Pipelinable*. Current version from which to do the increment. | ||
|
||
`-BumpType`:: *Required*. Must be one of `major`, `minor`, or `patch`. The new version number is incremented based on this value. | ||
|
||
`-PreRelease`:: *Optional*. If specified, sets the pre-release value of the new version. | ||
|
||
`-Build`:: *Optional*. If specified, sets the build value of the new version. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,29 @@ | ||
name: continuous integration | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
deployment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout source files | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get new version | ||
uses: arwynfr/actions-conventional-versioning/get-newVersion@v1 | ||
id: new-version | ||
|
||
- name: Update module manifest version | ||
shell: pwsh | ||
run: Update-ModuleManifest -ModuleVersion ${{ steps.new-version.outputs.next-version }} ./StepSemVer/StepSemVer.psd1 | ||
|
||
- name: Publish module on PSGallery | ||
shell: pwsh | ||
run: Publish-Module -Path ./StepSemVer/ -NuGetApiKey ${{ secrets.PSGALLERY_APIKEY }} | ||
|
||
- name: Tag new version on the repository | ||
uses: arwynfr/actions-conventional-versioning@v1 |
This file contains 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,22 @@ | ||
name: continuous integration | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
integration: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout source files | ||
uses: actions/checkout@v3 | ||
|
||
- name: Lint sources | ||
shell: pwsh | ||
run: Invoke-ScriptAnalyzer -Recurse -Severity Warning ./StepSemVer/ | ||
|
||
- name: Run unit tests | ||
shell: pwsh | ||
run: ./build/test.ps1 |
This file contains 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 contains 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 +1,35 @@ | ||
Get-ChildItem $PSScriptRoot\functions -Filter *.ps1 | ForEach-Object { . $_.FullName } | ||
function Step-SemVer { | ||
[CmdletBinding()] | ||
[OutputType([semver])] | ||
param ( | ||
[Parameter(ValueFromPipeline)] | ||
[semver] | ||
$Version, | ||
|
||
[Parameter(Mandatory)] | ||
[ValidateSet('major', 'minor', 'patch')] | ||
[string] | ||
$BumpType, | ||
|
||
[Parameter()] | ||
[string] | ||
$PreRelease = '', | ||
|
||
[Parameter()] | ||
[string] | ||
$Build = '' | ||
) | ||
|
||
Process { | ||
|
||
if ('major' -eq $BumpType) { | ||
return [semver]::new($Version.Major + 1, 0, 0, $PreRelease, $Build) | ||
} | ||
|
||
if ('minor' -eq $BumpType) { | ||
return [semver]::new($Version.Major, $Version.Minor + 1, 0, $PreRelease, $Build) | ||
} | ||
|
||
return [semver]::new($Version.Major, $Version.Minor, $Version.Patch + 1, $PreRelease, $Build) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.