diff --git a/.github/workflows/ci-develop.yml b/.github/workflows/ci-develop.yml index e7a83b9..c7c7b14 100644 --- a/.github/workflows/ci-develop.yml +++ b/.github/workflows/ci-develop.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Create and Push new tag shell: pwsh run: | diff --git a/.github/workflows/ci-hotfix.yml b/.github/workflows/ci-hotfix.yml index 958598c..9e7f16d 100644 --- a/.github/workflows/ci-hotfix.yml +++ b/.github/workflows/ci-hotfix.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Create and Push new tag shell: pwsh run: | diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index b9c6a43..2878262 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Create and Push new tag shell: pwsh run: | diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 983e607..0d595bc 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Create and Push new tag shell: pwsh run: | diff --git a/Readme.md b/Readme.md index abbd2c3..ce721d7 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,5 @@ # PowerSell Versioning Script -This script contains functions to manage git tags for software versions \ No newline at end of file +This script contains functions to manage git tags for software versions. + +Also there are sample Actions to trigger on each branch master/develop/release/hotfix. diff --git a/Scripts/VersionManager.ps1 b/Scripts/VersionManager.ps1 index 3258c9f..4f32998 100644 --- a/Scripts/VersionManager.ps1 +++ b/Scripts/VersionManager.ps1 @@ -37,12 +37,11 @@ function New-Tag function Get-CurrentVersion { + $major = 0; $minor = 1 $tags = Get-GitTags if ($tags.Count -gt 0) { - $major = 0; $minor = 1 - foreach($tag in $tags) { $pattern = '^v(\d+)\.(\d+)\.\d+$' @@ -59,11 +58,9 @@ function Get-CurrentVersion } } } - - return "$major.$minor" } - return "0.1" + return "$major.$minor" } function Get-NewPatch @@ -81,12 +78,6 @@ function Get-NewPatch return $Prefix + "-" + (Get-Date).ToString("yyMMddhhmmss") } -function Get-NextVersion -{ - $currentVersion = Get-CurrentVersion - return ([decimal]$currentVersion + 0.1).ToString() -} - function Get-GitTags { $tags = Invoke-Expression "git tag --list"