Draft release on master build (#1145)

* remove alpha postfix, releases will increment version

* update the master build job to draft a release

* add publish action to publish full release

* enable setting assembly and file version

* bump assembly and file version for package project

---------

Co-authored-by: BobLd <38405645+BobLd@users.noreply.github.com>
This commit is contained in:
Eliot Jones
2025-09-08 21:07:36 +02:00
committed by GitHub
parent dd5aa46c75
commit 8408c98aec
12 changed files with 114 additions and 12 deletions

View File

@@ -11,7 +11,7 @@
<PackageTags>PDF;Reader;Document;Adobe;PDFBox;PdfPig;pdf-extract;pdf-to-text;pdf;file;text;C#;dotnet;.NET</PackageTags>
<RepositoryUrl>https://github.com/UglyToad/PdfPig</RepositoryUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>0.1.12-alpha001</Version>
<Version>0.1.12</Version>
<AssemblyVersion>0.1.12.0</AssemblyVersion>
<FileVersion>0.1.12.0</FileVersion>
<PackageIconUrl>https://raw.githubusercontent.com/UglyToad/PdfPig/master/documentation/pdfpig.png</PackageIconUrl>

View File

@@ -1,5 +1,6 @@
$xml = New-Object XML
$xml.Load(".\tools\UglyToad.PdfPig.Package\UglyToad.PdfPig.Package.csproj")
$projectPath = Join-Path $PSScriptRoot "UglyToad.PdfPig.Package\UglyToad.PdfPig.Package.csproj"
$xml.Load($projectPath)
$current = $xml.Project.PropertyGroup[0].Version
$hyphenIndex = $current.IndexOf('-')
$len = If ($hyphenIndex -lt 0) { $current.Length } Else { $hyphenIndex }

View File

@@ -0,0 +1,20 @@
$xml = New-Object XML
$projectPath = Join-Path $PSScriptRoot "UglyToad.PdfPig.Package\UglyToad.PdfPig.Package.csproj"
$xml.Load($projectPath)
$current = $xml.Project.PropertyGroup[0].Version
$hyphenIndex = $current.IndexOf('-')
$len = If ($hyphenIndex -lt 0) { $current.Length } Else { $hyphenIndex }
$version = $current.Substring(0, $len)
# Split into parts
$parts = $version.Split('.')
# Increment last part (patch)
$patch = [int]$parts[-1]
$patch++
# Build new version string
$parts[-1] = $patch.ToString()
$newVersion = $parts -join '.'
Write-Output $newVersion

View File

@@ -1,6 +1,8 @@
param (
[Parameter(Position = 0, mandatory = $true)]
[string]$version
[string]$version,
[switch]$UpdateAssemblyAndFileVersion
)
$root = (Split-Path -parent $PSCommandPath)
@@ -17,6 +19,26 @@ $packageProjectPath = "$root/UglyToad.PdfPig.Package/UglyToad.PdfPig.Package.csp
$xml = New-Object XML
$xml.Load($packageProjectPath)
$xml.Project.PropertyGroup[0].Version = $version
if ($UpdateAssemblyAndFileVersion) {
# Update AssemblyVersion and FileVersion if the nodes exist, otherwise create them
if (-not $xml.Project.PropertyGroup[0].AssemblyVersion) {
$node = $xml.CreateElement("AssemblyVersion")
$node.InnerText = "$version.0" # add the 4th segment
$xml.Project.PropertyGroup[0].AppendChild($node) | Out-Null
} else {
$xml.Project.PropertyGroup[0].AssemblyVersion = "$version.0"
}
if (-not $xml.Project.PropertyGroup[0].FileVersion) {
$node = $xml.CreateElement("FileVersion")
$node.InnerText = "$version.0"
$xml.Project.PropertyGroup[0].AppendChild($node) | Out-Null
} else {
$xml.Project.PropertyGroup[0].FileVersion = "$version.0"
}
}
$xml.Save($packageProjectPath)
Write-Host $projs.Length