Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI on Develop
on:
push:
branches: [ develop ]
workflow_dispatch:

jobs:
create-new-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create and Push new tag
shell: pwsh
run: |
. ./Scripts/VersionManager.ps1
New-Tag -Branch "develop"
16 changes: 16 additions & 0 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI on Master
on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
create-new-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create and Push new tag
shell: pwsh
run: |
. ./Scripts/VersionManager.ps1
New-Tag -Branch "master"
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#PowerSell Versioning Script
# PowerSell Versioning Script

This script contains functions to manage git tags for software versions
44 changes: 39 additions & 5 deletions VersionManager.ps1 → Scripts/VersionManager.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
#################################
# This script contains funtions to create git tags following GitFlow
#################################
function New-Tag
{
param (
[Parameter(Mandatory=$true)]
[string]$Branch
)

$version = Get-CurrentVersion
$patch = Get-NewPatch
$prefix = ""

if ($Branch -eq "release")
{
$version = ([decimal]$currentVersion + 0.1).ToString()
$prefix = "Beta-"
}
if ($Branch -eq "develop")
{
$version = ([decimal]$currentVersion + 0.1).ToString()
$prefix = "Dev-"
}
if ($Branch -eq "hotfix")
{
$version = ([decimal]$currentVersion + 0.1).ToString()
$prefix = "HF-"
}

$tag = "v$version.$prefix$patch"

Invoke-Expression "git tag $tag"
Invoke-Expression "git push origin $tag"

return $tag
}

function Get-CurrentVersion
{
Expand Down Expand Up @@ -35,17 +69,17 @@ function Get-CurrentVersion

function Get-NewPatch
{
param (
param (
[Parameter(Mandatory=$false)]
[string]$Prefix = ""
)

if ($Prefix -ne "")
if ($Prefix -eq "")
{
return $Prefix + "-" + (Get-Date).ToString("yyMMddhhmmss")
return (Get-Date).ToString("yyMMddhhmmss")
}

return (Get-Date).ToString("yyMMddhhmmss")
return $Prefix + "-" + (Get-Date).ToString("yyMMddhhmmss")
}

function Get-NextVersion
Expand All @@ -58,4 +92,4 @@ function Get-GitTags
{
$tags = Invoke-Expression "git tag --list"
$tags
}
}