Skip to content

[WIP] add check to see if release notes was modified #9

[WIP] add check to see if release notes was modified

[WIP] add check to see if release notes was modified #9

name: Guarantee WebJobs Extension version is correct
on:
workflow_dispatch:
push:
branches: [ main, dev, dajusto/validate-release-notes-are-provided ]
paths:
- '*'
pull_request:
branches: [ main, dev, dajusto/validate-release-notes-are-provided ]
paths:
- '.github/workflows/guarantee-release-notes.yml'
- '.github/workflows/guarantee-version-correctness.yml'
jobs:
build:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'version-already-correct') }}
steps:
- uses: actions/checkout@v2
- name: Check .NET project version
shell: pwsh
run: |
$csprojPath = ".\src\WebJobs.Extensions.DurableTask\WebJobs.Extensions.DurableTask.csproj"
# Parse the .csproj file to reconstruct the version
[xml]$csproj = Get-Content -Path $csprojPath
$majorVersionString = $csproj.Project.PropertyGroup.MajorVersion
$minorVersionString = $csproj.Project.PropertyGroup.MinorVersion
$patchVersionString = $csproj.Project.PropertyGroup.PatchVersion
$version = "$majorVersionString.$minorVersionString.$patchVersionString"
$projectVersion = [Version]$version
# Obtain latest tag
git fetch --tags
$latestTag = git describe --tags $(git rev-list --tags --max-count=1)
Write-Output "Latest tag in the repository is $latestTag"
$latestTag = $latestTag.TrimStart('v')
$minVersion = [Version]$latestTag
# Split the version number by '.' character
$versionParts = $latestTag -split '\.'
# decompose the tag
$tagMajor = $versionParts[0]
$tagMinor = $versionParts[1]
$tagPatch = $versionParts[2]
# Set version components as environment variables for future use
"TAG_MAJOR=$($versionParts[0])" | Out-File -Append -FilePath $Env:GITHUB_ENV
"TAG_MINOR=$($versionParts[1])" | Out-File -Append -FilePath $Env:GITHUB_ENV
"TAG_PATCH=$($versionParts[2])" | Out-File -Append -FilePath $Env:GITHUB_ENV
"PROJ_MAJOR=$($tagMajor)" | Out-File -Append -FilePath $Env:GITHUB_ENV
"PROJ_MINOR=$($tagMinor)" | Out-File -Append -FilePath $Env:GITHUB_ENV
"PROJ_PATCH=$($tagPatch)" | Out-File -Append -FilePath $Env:GITHUB_ENV
# Compare the project version to the minimum required version
if ($projectVersion -lt $minVersion) {
Write-Error "WebJobs extension version ($projectVersion) is less than the minimum required version ($minVersion)."
exit 1
} else {
Write-Host "WebJobs extension version ($projectVersion) meets the minimum required version ($minVersion)."
}
- name: Check minorVersion
if: ${{ !contains(github.event.pull_request.labels.*.name, 'patch-pr') }}
shell: pwsh
run: |
$tagPatch = $env:TAG_PATCH
$projPatch = $env:PROJ_PATCH
# Compare the project version to the minimum required version
if ($projPatch -lt $tagPatch) {
$errorMessage = "WebJobs extension version ($projectVersion) it not" +
"a patch-release greater than the latest tag version ($minVersion)." +
"Please increment the patch version or remove the `patch-pr` label."
Write-Error $errorMessage
exit 1
} else {
Write-Host "WebJobs extension version ($projectVersion) at least a patch-release greater than the latest tag version ($minVersion)."
}