Skip to content

Commit 6e3b559

Browse files
committed
Work CD-CI
- Remove nuproj projects and replace with plain nuspec files. - Update AppVeyor yaml accordingly. - Replace gitversion with Nerdbank.GitVersioning. Signed-off-by: José Simões <[email protected]>
1 parent 6d94ba3 commit 6e3b559

13 files changed

+131
-280
lines changed

GitVersion.yml

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

appveyor.yml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ init:
4444
- 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}"
4545

4646
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
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+
- dotnet tool install --tool-path . nbgv
52+
- ps: .\install-vsix-appveyor.ps1
5453

5554
before_build:
5655
- ps: >-
@@ -59,25 +58,32 @@ before_build:
5958
6059
nuget restore source\nanoFramework.Hardware.Esp32.sln
6160
62-
dotnet-gitversion /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.Hardware.Esp32\Properties\AssemblyInfo.cs"
61+
.\nbgv cloud -p source -a -c
6362
6463
build_script:
65-
- ps: >-
66-
67-
msbuild source\nanoFramework.Hardware.Esp32.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
64+
- ps: msbuild source\nanoFramework.Hardware.Esp32.sln /p:PublicRelease=true /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
6865

6966
before_deploy:
67+
- ps: >-
68+
.\nbgv cloud --version=$env:NBGV_SemVer1
69+
70+
$env:MyNuGetVersion = $env:NBGV_NuGetPackageVersion -replace "\-g$env:NBGV_GitCommitIdShort", " "
71+
72+
.\generate-change-log.ps1
73+
74+
- nuget pack source\nanoFramework.Hardware.Esp32.nuspec -Version %MyNuGetVersion%
75+
- nuget pack source\nanoFramework.Hardware.Esp32.DELIVERABLES.nuspec -Version %MyNuGetVersion%
7076
- ps: >-
7177
.\commit-assemblyinfo-changes.ps1
7278
7379
.\generate-change-log.ps1
7480
75-
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\source\Nuget.nanoFramework.Hardware.Esp32\bin\Release\nanoFramework.Hardware.Esp32.$env:GitVersion_NuGetVersionV2.nupkg
81+
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\nanoFramework.Hardware.Esp32.$env:MyNuGetVersion.nupkg
7682
7783
after_deploy:
7884
# for this environment variable to work here it has to be set in AppVeyor UI
79-
- nuget push source\Nuget.nanoFramework.Hardware.Esp32\bin\Release\nanoFramework.Hardware.Esp32.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
80-
- nuget push source\Nuget.nanoFramework.Hardware.Esp32.DELIVERABLES\bin\Release\nanoFramework.Hardware.Esp32.DELIVERABLES.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
85+
- nuget push nanoFramework.Hardware.Esp32.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
86+
- nuget push nanoFramework.Hardware.Esp32.DELIVERABLES.%MyNuGetVersion%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
8187

8288
# requires APPVEYOR_DISCORD_WEBHOOK_URL enviroment variable set with Discord webhook URL
8389
on_failure:
@@ -87,8 +93,6 @@ on_failure:
8793
8894
cache:
8995
- source\packages -> **source\packages.config
90-
- C:\ProgramData\chocolatey\bin -> appveyor.yml
91-
- C:\ProgramData\chocolatey\lib -> appveyor.yml
9296

9397
################################################
9498
# override configuration for specific branches
@@ -98,7 +102,7 @@ for:
98102
branches:
99103
only:
100104
- master
101-
- /v.*/
105+
- /v\d.*/
102106

103107
deploy:
104108
- provider: NuGet
@@ -107,9 +111,9 @@ for:
107111
on:
108112
appveyor_repo_tag: true
109113
- provider: GitHub
110-
tag: v$(GitVersion_NuGetVersionV2)
111-
release: nanoFramework.Hardware.Esp32 Library v$(GitVersion_NuGetVersionV2)
112-
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Hardware.Esp32/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.Hardware.Esp32/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
114+
tag: v$(MyNuGetVersion)
115+
release: nanoFramework.Hardware.Esp32 Library v$(MyNuGetVersion)
116+
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Hardware.Esp32/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.Hardware.Esp32/$(MyNuGetVersion)) v$(MyNuGetVersion)'
113117
auth_token:
114118
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
115119
artifact: Nuget_Packages
@@ -122,13 +126,13 @@ for:
122126
-
123127
branches:
124128
only:
125-
- /dev.*/
129+
- /dev(elop)?$/
126130

127131
deploy:
128132
- provider: GitHub
129-
tag: v$(GitVersion_NuGetVersionV2)
130-
release: nanoFramework.Hardware.Esp32 Library v$(GitVersion_NuGetVersionV2)
131-
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Hardware.Esp32/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.Hardware.Esp32/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
133+
tag: v$(MyNuGetVersion)
134+
release: nanoFramework.Hardware.Esp32 Library v$(MyNuGetVersion)
135+
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Hardware.Esp32/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.Hardware.Esp32/$(MyNuGetVersion)) v$(MyNuGetVersion)'
132136
auth_token:
133137
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
134138
artifact: Nuget_Packages
@@ -150,9 +154,9 @@ for:
150154
on:
151155
appveyor_repo_tag: true
152156
- provider: GitHub
153-
tag: v$(GitVersion_NuGetVersionV2)
154-
release: nanoFramework.Hardware.Esp32 Library v$(GitVersion_NuGetVersionV2)
155-
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Hardware.Esp32/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.Hardware.Esp32/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
157+
tag: v$(MyNuGetVersion)
158+
release: nanoFramework.Hardware.Esp32 Library v$(MyNuGetVersion)
159+
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Hardware.Esp32/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.Hardware.Esp32/$(MyNuGetVersion)) v$(MyNuGetVersion)'
156160
auth_token:
157161
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
158162
artifact: Nuget_Packages

commit-assemblyinfo-changes.ps1

Lines changed: 2 additions & 18 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.Hardware.Esp32\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,7 +11,7 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
2711
cd nf-interpreter > $null
2812

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

3216
# create branch to perform updates
3317
git checkout -b "$newBranch" develop -q
@@ -56,7 +40,7 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
5640
}
5741
else
5842
{
59-
$commitMessage = "Update nanoFramework.Hardware.Esp32 version to $env:GitVersion_NuGetVersionV2"
43+
$commitMessage = "Update nanoFramework.Hardware.Esp32 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.nanoFramework.Hardware.Esp32.DELIVERABLES/Nuget.nanoFramework.Hardware.Esp32.DELIVERABLES.nuproj

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

source/Nuget.nanoFramework.Hardware.Esp32/Nuget.nanoFramework.Hardware.Esp32.nuproj

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

0 commit comments

Comments
 (0)