Skip to content

Commit d720555

Browse files
Get pre-release versions working correctly (#4751)
* Get pre-release versions working correctly * Update info on create/push a release
1 parent 581560d commit d720555

File tree

4 files changed

+97
-34
lines changed

4 files changed

+97
-34
lines changed

Source/Directory.Package.props

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
<Project>
22

3+
<!-- Read version from version.json -->
4+
<Target Name="ReadVersionFromJson" BeforeTargets="Build;Pack">
5+
<ReadLinesFromFile File="$(MSBuildThisFileDirectory)version.json">
6+
<Output TaskParameter="Lines" ItemName="VersionJsonLines" />
7+
</ReadLinesFromFile>
8+
<PropertyGroup>
9+
<VersionJsonContent>@(VersionJsonLines)</VersionJsonContent>
10+
<PackageVersionFromJson>$([System.Text.RegularExpressions.Regex]::Match($(VersionJsonContent), '"version"\s*:\s*"([^"]+)"').Groups[1].Value)</PackageVersionFromJson>
11+
</PropertyGroup>
12+
</Target>
313

414
<!-- Common Package Settings -->
515
<PropertyGroup>
16+
<PackageVersion>$(PackageVersionFromJson)</PackageVersion>
617
<PackageLicenseExpression>MIT</PackageLicenseExpression>
718
<PackageProjectUrl>https://cslanet.com</PackageProjectUrl>
819
<OutputPath>..\..\bin\packages\</OutputPath>
@@ -32,6 +43,13 @@
3243
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3344
</PackageReference>
3445
</ItemGroup>
46+
47+
<!-- Override Nerdbank.GitVersioning package version after it's calculated -->
48+
<Target Name="OverrideNerdBankPackageVersion" BeforeTargets="GenerateNuspec">
49+
<PropertyGroup>
50+
<PackageVersion>$(PackageVersionFromJson)</PackageVersion>
51+
</PropertyGroup>
52+
</Target>
3553

3654
<ItemGroup Condition="'$(IsPackable)'=='true' AND '$(PackageIcon)'!=''">
3755
<None Include="$(MSBuildThisFileDirectory)..\Source\readme.md" Pack="true" PackagePath="\" />

Source/version.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "10.0.0-alpha.1",
4-
"publicReleaseRefSpec": [ "^refs/heads/release$" ]
3+
"version": "10.0.0-alpha.3",
4+
"publicReleaseRefSpec": [
5+
"^refs/heads/.*"
6+
],
7+
"nuGetPackageVersion": {
8+
"semVer": 2
9+
},
10+
"assemblyVersion": {
11+
"precision": "build"
12+
}
513
}

Support/push-nuget-packages.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Push NuGet packages to nuget.org
4+
# Usage: ./push-nuget-packages.sh <api-key>
5+
6+
set -e
7+
8+
if [ -z "$1" ]; then
9+
echo "Error: API key parameter is required"
10+
echo "Usage: $0 <api-key>"
11+
exit 1
12+
fi
13+
14+
API_KEY="$1"
15+
PACKAGES_DIR="$(dirname "$0")/../bin/packages"
16+
17+
if [ ! -d "$PACKAGES_DIR" ]; then
18+
echo "Error: Packages directory not found: $PACKAGES_DIR"
19+
exit 1
20+
fi
21+
22+
NUPKG_FILES=("$PACKAGES_DIR"/*.nupkg)
23+
24+
if [ ! -e "${NUPKG_FILES[0]}" ]; then
25+
echo "Error: No .nupkg files found in $PACKAGES_DIR"
26+
exit 1
27+
fi
28+
29+
echo "Found $(find "$PACKAGES_DIR" -name "*.nupkg" | wc -l) NuGet package(s) to push..."
30+
31+
for package in "$PACKAGES_DIR"/*.nupkg; do
32+
if [ -f "$package" ]; then
33+
echo "Pushing $package..."
34+
dotnet nuget push "$package" --api-key "$API_KEY" --source https://api.nuget.org/v3/index.json
35+
echo "✓ Successfully pushed $(basename "$package")"
36+
fi
37+
done
38+
39+
echo "✓ All packages pushed successfully!"
Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
1-
Prerequisites
2-
-------------
1+
# Create a CSLA .NET release
2+
3+
## Prerequisites
4+
35
You must have:
46

5-
1. PC
6-
1. Windows 11 or 10
7-
2. .NET 6 SDK
8-
2. .NET 7 SDK
9-
2. .NET 8 SDK
10-
3. Visual Studio 2022 with the latest updates
11-
1. Maui
12-
1. UWP SDK
13-
1. Blazor templates
14-
15-
Semantic Versioning
16-
-------------------
7+
1. Windows PC
8+
a. Windows 11
9+
a. .NET SDKs
10+
1. 8 SDK
11+
1. 9 SDK
12+
1. 10 SDK
13+
a. Visual Studio 2026 with the latest updates/toolsets
14+
1. Maui
15+
1. Blazor templates
16+
17+
## Semantic Versioning
18+
1719
CSLA .NET, starting with version 4.9.0, follows the [semantic versioning (semver)](https://semver.org/) guidelines. Version numbers should follow the semver guidance from that point forward.
1820

19-
NuGet release
20-
-------------
21+
## NuGet release
22+
2123
1. Pull the latest code from MarimerLLC/csla
22-
1. Open the csla.build.sln
23-
1. Update version numbers
24-
1. `cd /Source`
25-
1. Edit `Directory.Build.props` and update the version number
26-
1. `grep -rl --include=*.cs --include=*.csproj --include=*.Build.props '7\.0\.2' | xargs sed -i 's/7\.0\.2/8.0.0/g'`
27-
1. Adjust the version numbers to match current versions
28-
1. Build the solution in Release mode; Any CPU
24+
1. Open the `Source/version.json` file and update the version number
2925
1. Do NuGet release
30-
1. Open a powershell window
31-
1. Run the `nuget/Build All.ps1` script (add /prerelease:yymmddxx for test release)
32-
1. Make sure you have Rocky's NuGet key installed (see Nuget.org)
33-
1. Run the `nuget/Push All.ps1` script
26+
1. Open a terminal window
27+
1. Change to the `csla/Source` folder
28+
1. Run `dotnet pack csla.build.sln`
29+
1. Make sure you have Rocky's NuGet API key (see Nuget.org)
30+
1. Change to the `csla/Support` folder
31+
1. Run the `csla/Support/push-nuget-packages.sh` bash script to push the packages
32+
33+
## Finalize Release
3434

35-
Finalize Release
36-
----------------
3735
1. Update GitHub
3836
1. Update [releasenotes.md](https://github.com/MarimerLLC/csla/blob/master/releasenotes.md)
3937
1. Commit all changes to git
40-
1. Create PR
38+
1. Create PR
4139
1. Accept PR
4240
1. In the GitHub releases web page create the release
43-
1. Create a new release at HEAD using the version number (such as v7.0.2)
44-
1. Name the release like "Version 7.0.2 Release"
41+
1. Create a new release at HEAD using the version number (such as v10.0.2)
42+
1. Name the release like "Version 10.0.2 Release"
4543
1. Mark the release as pre-release or release

0 commit comments

Comments
 (0)