Skip to content

Commit bb1bcaa

Browse files
committed
1.0.0
1 parent 459fa74 commit bb1bcaa

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed

invoke.build.ps1

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ function readProjectFileProperty {
6262
$propertyValue
6363
}
6464

65+
function changelogTopVersionAndDate {
66+
67+
$topSectionVersion = ""
68+
$topSectionDate = ""
69+
70+
foreach ( $line in ( Get-Content .\CHANGELOG.md ) ) {
71+
$versionMatch = ( [ regex ] "^#+ (\d+(?:\.\d+){2,}(?:-\S+)?) \((\S+)\)" ).Match( $line )
72+
if ( $versionMatch.Success ) {
73+
$topSectionVersion , $topSectionDate = $versionMatch.Groups[ 1 ].Value , $versionMatch.Groups[ 2 ].Value
74+
break
75+
}
76+
}
77+
78+
$topSectionVersion , $topSectionDate
79+
}
80+
6581
task . Build
6682

6783
task Clean {
@@ -136,9 +152,16 @@ task PackInternal {
136152
$yearStart = Get-Date -Year ( ( Get-Date ).Year ) -Month 1 -Day 1 -Hour 0 -Minute 0 -Second 0 -Millisecond 0
137153
$now = Get-Date
138154
$seconds = [ int ] ( $now - $yearStart ).TotalSeconds
139-
$internalVersionPrefix = "$VersionPrefix.$seconds"
140-
exec { dotnet pack ./src -c $Configuration -p:VersionPrefix=$internalVersionPrefix }
141-
$internalFullVersion = combinePrefixSuffix $internalVersionPrefix $VersionSuffix
155+
if ( $VersionSuffix ) {
156+
$internalVersionPrefix = $VersionPrefix
157+
$internalVersionSuffix = "$VersionSuffix.$seconds"
158+
}
159+
else {
160+
$internalVersionPrefix = "$VersionPrefix.$seconds"
161+
$internalVersionSuffix = $VersionSuffix
162+
}
163+
exec { dotnet pack ./src -c $Configuration -p:VersionPrefix=$internalVersionPrefix -p:VersionSuffix=$internalVersionSuffix }
164+
$internalFullVersion = combinePrefixSuffix $internalVersionPrefix $internalVersionSuffix
142165
$filename = "$basePackageName.$internalFullVersion.nupkg"
143166
Copy-Item ./src/bin/$Configuration/$filename $LocalPackageDir
144167
Write-Build Green "Copied $filename to $LocalPackageDir"
@@ -158,3 +181,26 @@ task EnsureCommitted {
158181
$gitoutput = exec { git status -s -uall }
159182
if ( $gitoutput ) { throw "uncommitted changes exist in working directory" }
160183
}
184+
185+
task UpdateProjectFromChangelog {
186+
$version , $date = changelogTopVersionAndDate
187+
if ( $version -match '-' ) {
188+
$prefix , $suffix = $version -split '-'
189+
}
190+
else {
191+
$prefix , $suffix = $version , ""
192+
}
193+
194+
writeProjectFileProperty $mainProjectFilePath "VersionPrefix" $prefix
195+
writeProjectFileProperty $mainProjectFilePath "VersionSuffix" $suffix
196+
197+
$anchor = ( $version -replace '\.','' ) + "-$date"
198+
$url = "https://github.com/zanaptak/TypedCssClasses/blob/main/CHANGELOG.md#$anchor"
199+
200+
writeProjectFileProperty $mainProjectFilePath "PackageReleaseNotes" $url
201+
202+
Write-Build Green "****"
203+
Write-Build Green "**** Assumed changelog URL (VERIFY): $url"
204+
Write-Build Green "****"
205+
206+
} , ReportProjectFileVersion

src/TypedCssClasses.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
66
<Configurations>Debug;Release;ReleaseTest</Configurations>
7-
<VersionPrefix>0.4.0</VersionPrefix>
7+
<VersionPrefix>1.0.0</VersionPrefix>
88
<VersionSuffix></VersionSuffix>
99
<PackageId>Zanaptak.TypedCssClasses</PackageId>
1010
<Authors>zanaptak</Authors>
@@ -14,7 +14,7 @@
1414
<Description>A CSS class type provider for F# web development. Bring external stylesheet classes into your F# code as design-time discoverable compiler-verified properties.</Description>
1515
<AssemblyName>Zanaptak.TypedCssClasses</AssemblyName>
1616
<PackageProjectUrl>https://github.com/zanaptak/TypedCssClasses</PackageProjectUrl>
17-
<PackageReleaseNotes>https://github.com/zanaptak/TypedCssClasses/releases</PackageReleaseNotes>
17+
<PackageReleaseNotes>https://github.com/zanaptak/TypedCssClasses/blob/main/CHANGELOG.md#100-2021-07-30</PackageReleaseNotes>
1818
<RepositoryUrl>https://github.com/zanaptak/TypedCssClasses.git</RepositoryUrl>
1919
<RepositoryType>git</RepositoryType>
2020
<IncludeSymbols>true</IncludeSymbols>

0 commit comments

Comments
 (0)