Skip to content

Commit f94efe6

Browse files
committed
Work CD-CI
- Remove nuproj projects and replace with plain nuspec files. - Update AppVeyor yaml accordingly. - Replace gitversion with Nerdbank.GitVersioning. - Rework update dependencies PS to update nuspec instead of nuproj. Signed-off-by: José Simões <[email protected]>
1 parent d80e7a3 commit f94efe6

15 files changed

+152
-250
lines changed

appveyor.yml

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ skip_commits:
1616
- 'LICENSE'
1717
- dir/*
1818
- '.gitignore'
19+
- 'azure-pipelines.yml'
1920

2021
build:
2122
verbosity: minimal
@@ -44,13 +45,12 @@ init:
4445
- ps: "if($env:APPVEYOR_PULL_REQUEST_NUMBER -eq \"\")\n{\n \n if($env:APPVEYOR_REPO_COMMIT_AUTHOR -eq \"nfbot\" -and $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED -like \"*[version update]*\")\n {\n # commit was from nfbot AND it's taged as a [version update]\n # OK to skip AppVeyor build \n \"Version update only. Skipping build.\" | Write-Host -BackgroundColor White -ForegroundColor Blue\n Exit-AppveyorBuild\n }\n}"
4546

4647
install:
47-
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
48-
- bundle config --local path vendor/bundle
49-
- gem install bundler --quiet --no-ri --no-rdoc
50-
- gem install github_changelog_generator --quiet --no-ri --no-rdoc
51-
# this needs to be replace with the official version and nuget package as soon as it's released
52-
- dotnet tool install -g --version 4.0.0-pullrequest1422-1625 --add-source https://ci.appveyor.com/nuget/gitversion-8nigugxjftrw GitVersion.CommandLine.DotNetCore.Tool
53-
- ps: .\install-vsix-appveyor.ps1
48+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
49+
- bundle config --local path vendor/bundle
50+
- gem install bundler --quiet --no-ri --no-rdoc
51+
- gem install github_changelog_generator --quiet --no-ri --no-rdoc
52+
- dotnet tool install --tool-path . nbgv
53+
- ps: .\install-vsix-appveyor.ps1
5454

5555
before_build:
5656
- ps: >-
@@ -59,25 +59,32 @@ before_build:
5959
6060
nuget restore source\nanoFramework.System.Net.sln
6161
62-
dotnet-gitversion /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.System.Net\Properties\AssemblyInfo.cs"
62+
.\nbgv cloud -p source -a -c
6363
6464
build_script:
65-
- ps: >-
66-
67-
msbuild source\nanoFramework.System.Net.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
65+
- ps: msbuild source\nanoFramework.System.Net.sln /p:PublicRelease=true /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
6866

6967
before_deploy:
68+
- ps: >-
69+
.\nbgv cloud --version=$env:NBGV_SemVer1
70+
71+
$env:MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", " "
72+
73+
.\generate-change-log.ps1
74+
75+
- nuget pack source\nanoFramework.System.Net.nuspec -Version %MyNuGetVersion%
76+
- nuget pack source\nanoFramework.System.Net.DELIVERABLES.nuspec -Version %MyNuGetVersion%
7077
- ps: >-
7178
.\commit-assemblyinfo-changes.ps1
7279
7380
.\generate-change-log.ps1
7481
75-
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\source\Nuget.System.Net\bin\Release\nanoFramework.System.Net.$env:GitVersion_NuGetVersionV2.nupkg
82+
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\nanoFramework.System.Net.$env:MyNuGetVersion.nupkg
7683
7784
after_deploy:
7885
# for this environment variable to work here it has to be set in AppVeyor UI
79-
- nuget push source\Nuget.System.Net\bin\Release\nanoFramework.System.Net.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
80-
- nuget push source\Nuget.System.Net.DELIVERABLES\bin\Release\nanoFramework.System.Net.DELIVERABLES.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
86+
- nuget push nanoFramework.System.Net.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
87+
- nuget push nanoFramework.System.Net.DELIVERABLES.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
8188

8289
# requires APPVEYOR_DISCORD_WEBHOOK_URL enviroment variable set with Discord webhook URL
8390
on_failure:
@@ -101,7 +108,7 @@ for:
101108
branches:
102109
only:
103110
- master
104-
- /v.*/
111+
- /v\d.*/
105112

106113
deploy:
107114
- provider: NuGet
@@ -110,9 +117,9 @@ for:
110117
on:
111118
appveyor_repo_tag: true
112119
- provider: GitHub
113-
tag: v$(GitVersion_NuGetVersionV2)
114-
release: nanoFramework System.Net Library v$(GitVersion_NuGetVersionV2)
115-
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/blob/master/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.System.Net/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
120+
tag: v$(MyNuGetVersion)
121+
release: nanoFramework System.Net Library v$(MyNuGetVersion)
122+
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/blob/master/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.System.Net/$(MyNuGetVersion)) v$(MyNuGetVersion)'
116123
auth_token:
117124
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
118125
artifact:
@@ -125,13 +132,13 @@ for:
125132
-
126133
branches:
127134
only:
128-
- /dev.*/
135+
- /dev(elop)?$/
129136

130137
deploy:
131138
- provider: GitHub
132-
tag: v$(GitVersion_NuGetVersionV2)
133-
release: nanoFramework System.Net Library v$(GitVersion_NuGetVersionV2)
134-
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from nanoFramework MyGet development feed\n\nThe following NuGet packages are available for download from this release\n\npackage: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.System.Net/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
139+
tag: v$(MyNuGetVersion)
140+
release: nanoFramework System.Net Library v$(MyNuGetVersion)
141+
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from nanoFramework MyGet development feed\n\nThe following NuGet packages are available for download from this release\n\npackage: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.System.Net/$(MyNuGetVersion)) v$(MyNuGetVersion)'
135142
auth_token:
136143
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
137144
artifact:
@@ -153,9 +160,9 @@ for:
153160
on:
154161
appveyor_repo_tag: true
155162
- provider: GitHub
156-
tag: v$(GitVersion_NuGetVersionV2)
157-
release: nanoFramework System.Net Library v$(GitVersion_NuGetVersionV2)
158-
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.System.Net/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
163+
tag: v$(MyNuGetVersion)
164+
release: nanoFramework System.Net Library v$(MyNuGetVersion)
165+
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.System.Net/blob/$(appveyor_repo_branch)/CHANGELOG.md)\n\n## Install from NuGet\n\nThe following NuGet packages are available for download from this release\n\n:package: [.NET](https://www.nuget.org/packages/nanoFramework.System.Net/$(MyNuGetVersion)) v$(MyNuGetVersion)'
159166
auth_token:
160167
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
161168
artifact:

commit-assemblyinfo-changes.ps1

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
# Copyright (c) 2018 The nanoFramework project contributors
22
# See LICENSE file in the project root for full license information.
33

4-
# skip updating assembly info changes if build is a pull-request or not a tag (can't commit when repo is in a tag)
5-
if ($env:appveyor_pull_request_number -or $env:APPVEYOR_REPO_TAG -eq "true")
6-
{
7-
'Skip committing assembly info changes...' | Write-Host -ForegroundColor White
8-
}
9-
else
10-
{
11-
# updated assembly info files
12-
git add "source\nanoFramework.System.Net\Properties\AssemblyInfo.cs"
13-
git commit -m "Update assembly info file for v$env:GitVersion_NuGetVersionV2" -m"[version update]"
14-
git push origin --porcelain -q > $null
15-
16-
'Updated assembly info...' | Write-Host -ForegroundColor White -NoNewline
17-
'OK' | Write-Host -ForegroundColor Green
18-
}
19-
204
# update assembly info in nf-interpreter if this is tag
215
if ($env:APPVEYOR_REPO_TAG -eq "true")
226
{
@@ -27,13 +11,13 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
2711
cd nf-interpreter
2812

2913
# new branch name
30-
$newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/nanoFramework.System.Net/$env:GitVersion_NuGetVersionV2"
14+
$newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/nanoFramework.System.Net/$env:MyNuGetVersion"
3115

3216
# create branch to perform updates
3317
git checkout -b "$newBranch" develop -q
3418

3519
# replace version in assembly declaration
36-
$newVersion = $env:GitVersion_AssemblySemFileVer -replace "\." , ", "
20+
$newVersion = $env:NBGV_AssemblyFileVersion -replace "\." , ", "
3721
$newVersion = "{ $newVersion }"
3822

3923
$versionRegex = "\{\s*\d+\,\s*\d+\,\s*\d+\,\s*\d+\s*}"
@@ -56,7 +40,7 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
5640
}
5741
else
5842
{
59-
$commitMessage = "Update nanoFramework.System.Net version to $env:GitVersion_AssemblySemFileVer"
43+
$commitMessage = "Update nanoFramework.System.Net version to $env:MyNuGetVersion"
6044

6145
# commit changes
6246
git add -A 2>&1

generate-change-log.ps1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ else
1414
if ($env:APPVEYOR_REPO_BRANCH -eq "master" -or $env:APPVEYOR_REPO_BRANCH -match "^release*")
1515
{
1616
# generate change log including future version
17-
bundle exec github_changelog_generator --token $env:GitHubToken --future-release "v$env:GitVersion_MajorMinorPatch"
17+
bundle exec github_changelog_generator --token $env:GitHubToken --future-release "v$env:NBGV_Version"
1818
}
1919
else
2020
{
@@ -23,8 +23,14 @@ else
2323
bundle exec github_changelog_generator --token $env:GitHubToken
2424
}
2525

26-
# updated changelog and the updated assembly info files
27-
git add CHANGELOG.md
28-
git commit -m "Update CHANGELOG for v$env:GitVersion_NuGetVersionV2"
29-
git push origin --porcelain -q > $null
26+
# updated changelog, if there are any differences
27+
$logDif = git diff CHANGELOG.md
28+
29+
if($logDif -ne $null)
30+
{
31+
git add CHANGELOG.md
32+
git commit -m "Update CHANGELOG for v$env:MyNuGetVersion"
33+
# need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr
34+
git push origin --porcelain | Write-Host
35+
}
3036
}

source/Nuget.System.Net.DELIVERABLES/Nuget.System.Net.DELIVERABLES.nuproj

Lines changed: 0 additions & 74 deletions
This file was deleted.

source/Nuget.System.Net/Nuget.System.Net.nuproj

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>nanoFramework.System.Net.DELIVERABLES</id>
5+
<version>$version$</version>
6+
<title>nanoFramework.System.Net.DELIVERABLES</title>
7+
<authors>nanoFramework project contributors</authors>
8+
<owners>nanoFramework project contributors</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<releaseNotes></releaseNotes>
11+
<developmentDependency>false</developmentDependency>
12+
<projectUrl>https://github.com/nanoframework</projectUrl>
13+
<iconUrl>https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad</iconUrl>
14+
<copyright>Copyright (c) 2018 The nanoFramework project contributors</copyright>
15+
<description>** DON'T REFERENCE THIS PACKAGE ** Not meant for development. This package includes the deliverable artifacts of the nanoFramework.System.Net assembly for nanoFramework. These are for testing purposes and for updating the native code base of the library.</description>
16+
<summary>nanoFramework.System.Net.DELIVERABLES is not meant for development.</summary>
17+
<tags></tags>
18+
<dependencies>
19+
<dependency id="nanoFramework.CoreLibrary" version="[1.0.5-preview024]" />
20+
</dependencies>
21+
</metadata>
22+
<files>
23+
<file src="nanoFramework.System.Net\bin\Release\Stubs\*.*" target="content\Stubs\" />
24+
<file src="nanoFramework.System.Net\obj\Release\*.txt" target="content\txt\" />
25+
<file src="nanoFramework.System.Net\obj\Release\*.dump" target="content\dump\" />
26+
<file src="nanoFramework.System.Net\obj\Release\*.strings" target="content\dump\" />
27+
<file src="nanoFramework.System.Net\obj\Release\*.resources" target="content\resources\" />
28+
<file src="nanoFramework.System.Net\obj\Release\*.il" target="content\disasm\" />
29+
</files>
30+
</package>

0 commit comments

Comments
 (0)