Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 0bd0522

Browse files
authored
ci: update release strategy (#337)
Use simple strategy with extra files to update changelog & csproj files
1 parent 18e1418 commit 0bd0522

File tree

3 files changed

+83
-72
lines changed

3 files changed

+83
-72
lines changed

release-please-config.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22
"packages": {
33
".": {
44
"changelog-path": "CHANGELOG.md",
5-
"release-type": "dotnet-yoshi",
5+
"release-type": "simple",
66
"bump-minor-pre-major": false,
77
"bump-patch-for-minor-pre-major": false,
88
"draft": false,
99
"prerelease": false,
1010
"bootstrap-sha": "e9b73fc10c023bc83c0b7816d7e872199d92cbee",
11-
"exclude-paths": ["./.azure-pipelines", "./.github", "./.idea", "./.vs", "./.vscode"]
11+
"exclude-paths": [
12+
".azure-pipelines",
13+
".github",
14+
".idea",
15+
".vs",
16+
".vscode",
17+
"src/",
18+
"src/Microsoft.Graph.Cli.Core.Tests"
19+
],
20+
"extra-files": [
21+
{
22+
"type": "xml",
23+
"path": "src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj",
24+
"xpath": "//Project/PropertyGroup/Version"
25+
}
26+
]
1227
}
1328
},
1429
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
Lines changed: 65 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,65 @@
1-
# Copyright (c) Microsoft Corporation. All rights reserved.
2-
# Licensed under the MIT License.
3-
4-
<#
5-
.Synopsis
6-
Gets the latest production release version of the specified NuGet package.
7-
8-
.Description
9-
Gets the NuGet package version of latest production release and compares the
10-
version to the version set in the specified project file. If they match, this
11-
script will fail and indicate that the version needs to be updated.
12-
13-
.Parameter packageName
14-
Specifies the package name of the package. For example, 'microsoft.kiota.abstractions'
15-
is a valid package name.
16-
17-
.Parameter projectPath
18-
Specifies the path to the project file.
19-
#>
20-
21-
Param(
22-
[parameter(Mandatory = $true)]
23-
[string]$packageName,
24-
25-
[parameter(Mandatory = $true)]
26-
[string]$projectPath
27-
)
28-
29-
[xml]$xmlDoc = Get-Content $projectPath
30-
31-
# Assumption: VersionPrefix is set in the first property group.
32-
$versionPrefixString = $xmlDoc.Project.PropertyGroup[0].VersionPrefix
33-
if($xmlDoc.Project.PropertyGroup[0].VersionSuffix){
34-
$versionPrefixString = $versionPrefixString + "-" + $xmlDoc.Project.PropertyGroup[0].VersionSuffix
35-
}
36-
37-
38-
# System.Version, get the version prefix.
39-
$currentProjectVersion = [System.Management.Automation.SemanticVersion]"$versionPrefixString"
40-
41-
# API is case-sensitive
42-
$packageName = $packageName.ToLower()
43-
$url = "https://api.nuget.org/v3/registration5-gz-semver2/$packageName/index.json"
44-
45-
# Call the NuGet API for the package and get the current published version.
46-
Try {
47-
$nugetIndex = Invoke-RestMethod -Uri $url -Method Get
48-
}
49-
Catch {
50-
if ($_.ErrorDetails.Message && $_.ErrorDetails.Message.Contains("The specified blob does not exist.")) {
51-
Write-Host "No package exists. You will probably be publishing $packageName for the first time."
52-
Exit # exit gracefully
53-
}
54-
55-
Write-Host $_
56-
Exit 1
57-
}
58-
59-
$currentPublishedVersion = [System.Management.Automation.SemanticVersion]$nugetIndex.items[0].upper
60-
61-
# Validate that the version number has been updated.
62-
if ($currentProjectVersion -le $currentPublishedVersion) {
63-
64-
Write-Error "The current published version number, $currentPublishedVersion, and the version number `
65-
in the csproj file, $currentProjectVersion, match. You must increment the version"
66-
}
67-
else {
68-
Write-Host "Validated that the version has been updated from $currentPublishedVersion to $currentProjectVersion" -ForegroundColor Green
69-
}
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
<#
5+
.Synopsis
6+
Gets the latest production release version of the specified NuGet package.
7+
8+
.Description
9+
Gets the NuGet package version of latest production release and compares the
10+
version to the version set in the specified project file. If they match, this
11+
script will fail and indicate that the version needs to be updated.
12+
13+
.Parameter packageName
14+
Specifies the package name of the package. For example, 'microsoft.kiota.abstractions'
15+
is a valid package name.
16+
17+
.Parameter projectPath
18+
Specifies the path to the project file.
19+
#>
20+
21+
Param(
22+
[parameter(Mandatory = $true)]
23+
[string]$packageName,
24+
25+
[parameter(Mandatory = $true)]
26+
[string]$projectPath
27+
)
28+
29+
[xml]$xmlDoc = Get-Content $projectPath
30+
31+
# Assumption: Version is set in the first property group.
32+
$versionString = $xmlDoc.Project.PropertyGroup[0].Version
33+
34+
# System.Version, get the version.
35+
$currentProjectVersion = [System.Management.Automation.SemanticVersion]"$versionString"
36+
37+
# API is case-sensitive
38+
$packageName = $packageName.ToLower()
39+
$url = "https://api.nuget.org/v3/registration5-gz-semver2/$packageName/index.json"
40+
41+
# Call the NuGet API for the package and get the current published version.
42+
Try {
43+
$nugetIndex = Invoke-RestMethod -Uri $url -Method Get
44+
}
45+
Catch {
46+
if ($_.ErrorDetails.Message && $_.ErrorDetails.Message.Contains("The specified blob does not exist.")) {
47+
Write-Host "No package exists. You will probably be publishing $packageName for the first time."
48+
Exit # exit gracefully
49+
}
50+
51+
Write-Host $_
52+
Exit 1
53+
}
54+
55+
$currentPublishedVersion = [System.Management.Automation.SemanticVersion]$nugetIndex.items[0].upper
56+
57+
# Validate that the version number has been updated.
58+
if ($currentProjectVersion -le $currentPublishedVersion) {
59+
60+
Write-Error "The current published version number, $currentPublishedVersion, and the version number `
61+
in the csproj file, $currentProjectVersion, match. You must increment the version"
62+
}
63+
else {
64+
Write-Host "Validated that the version has been updated from $currentPublishedVersion to $currentProjectVersion" -ForegroundColor Green
65+
}

src/Microsoft.Graph.Cli.Core/Microsoft.Graph.Cli.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Nullable>enable</Nullable>
88
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
99
<DebugType>embedded</DebugType>
10-
<VersionPrefix>1.1.0</VersionPrefix>
10+
<Version>1.1.0</Version>
1111
<IsTrimmable>true</IsTrimmable>
1212

1313
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>

0 commit comments

Comments
 (0)