Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
user=nanoframework
project=lib-nanoFramework.Networking.Sntp
issues=true
add_issues_wo_labels=false
add_pr_wo_labels=false
add_issues_wo_labels=false
filter_issues_by_milestone=false
exclude_labels=Area: Config-and-Build,Area: Infrastructure-and-Organization,reverted
enhancement_labels=Type: enhancement
bug_labels=Type: bug
merge_prefix=**Documentation and other chores:**
unreleased_label=**Changes available only in 'Preview' NuGet packages:**
issue_line_labels=Breaking-Change,documentation
author=false
20 changes: 16 additions & 4 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
next-version: 1.0.0
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{LegacySemVerPadded}'
build-metadata-padding: 3
legacy-semver-padding: 3
assembly-informational-format: '{LegacySemVerPadded}'
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
commit-message-incrementing: MergeMessageOnly
branches:
master:
mode: ContinuousDelivery
Expand All @@ -15,12 +15,24 @@ branches:
prevent-increment-of-merged-branch-version: true
track-merge-target: false
develop:
regex: dev(elop)?(ment)?$
mode: ContinuousDeployment
tag: preview
increment: Minor
increment: Patch
prevent-increment-of-merged-branch-version: false
track-merge-target: true
tracks-release-branches: true
is-release-branch: false
release:
tag: rc
(pull|pull\-requests|pr)[/-]:
pull-request:
regex: (pull|pull\-requests|pr)[/-]
tag: alpha
mode: ContinuousDelivery
increment: Inherit
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
ignore:
sha: []
105 changes: 65 additions & 40 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
GitHubUserName:
secure: 7OBtVAMTodMWK20wg6pGnQ==
GitHubUserEmail:
secure: HeABB68Sn/Lhbd69C2cUcfWv0ab/rMDEcOLvcxf8gGw=
secure: /NpmL1KqwHyHFnF0GlUovA586wDIt8Hg/Q8Dro6kUpk=
GitHubToken:
secure: WOqlCsnwTzfDPJFoNV/h8mEESIpG/9uFn1u6oE8hGZtXwIQQlsY+NyyLt9Y5xoFn
secure: i/2hGsqVMwzdM5yIS4rxOIeG3ftx7su7klWYN80s/fHvgk7A5H2fF3oUTNLcyTbw
GitRestAuth:
secure: E3bCMe4LtDdAhHSYRcLp0N6DixJe1m8TNxhYeJW/GnqM3WXdRqsgkHSbwootPjJQtOQJrps4twmzTVzofLSVgPgbzU8PxU0AkJV7zwkyVOE=

init:
- git config --global core.autocrlf true
Expand All @@ -42,8 +44,9 @@

install:
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
- bundle config --local path vendor/bundle
- gem install bundler --quiet --no-ri --no-rdoc
- gem install github_changelog_generator --quiet --no-ri --no-rdoc
# - bundle install
- choco install gitversion.portable -pre -y
- ps: .\install-vsix-appveyor.ps1

Expand All @@ -54,20 +57,18 @@

nuget restore source\nanoFramework.Networking.Sntp.sln

gitversion /l console /output buildserver /updateAssemblyInfo /ensureassemblyinfo
C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools\GitVersion.exe /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.Runtime.Events\Properties\AssemblyInfo.cs"

build_script:
- ps: >-

msbuild source\nanoFramework.Networking.Sntp.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

before_deploy:
# need this to keep ruby happy
- ps: md c:\tmp
- bundle exec github_changelog_generator --token %GitHubToken%
# add here the updated changelog and the updated assembly info files
- git add .
- git commit --amend --no-edit
- ps: >-
.\commit-assemblyinfo-changes.ps1

.\generate-change-log.ps1

artifacts:
- path: '**\bin\Release\*.nupkg'
Expand All @@ -83,7 +84,7 @@
- provider: GitHub
tag: v$(GitVersion_NuGetVersionV2)
release: nanoFramework.Networking.Sntp Library v$(gitversion_semver)
description: '[CHANGELOG.md](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/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.Networking.Sntp/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Runtime.Events/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.Runtime.Events/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact: Nuget_Packages
Expand All @@ -95,7 +96,7 @@
on_failure:
- ps: |

cd ..
cd $env:APPVEYOR_BUILD_FOLDER

.\appveyor-discord.ps1 failure $env:APPVEYOR_DISCORD_WEBHOOK_URL

Expand All @@ -116,7 +117,6 @@

skip_branch_with_pr: true

# Do not build on tags
skip_tags: false

test: off
Expand All @@ -136,7 +136,31 @@
build:
verbosity: minimal

environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
matrix:
- RUBY_VERSION: 24
GitHubUserName:
secure: 7OBtVAMTodMWK20wg6pGnQ==
GitHubUserEmail:
secure: /NpmL1KqwHyHFnF0GlUovA586wDIt8Hg/Q8Dro6kUpk=
GitHubToken:
secure: i/2hGsqVMwzdM5yIS4rxOIeG3ftx7su7klWYN80s/fHvgk7A5H2fF3oUTNLcyTbw
GitRestAuth:
secure: E3bCMe4LtDdAhHSYRcLp0N6DixJe1m8TNxhYeJW/GnqM3WXdRqsgkHSbwootPjJQtOQJrps4twmzTVzofLSVgPgbzU8PxU0AkJV7zwkyVOE=

init:
- git config --global core.autocrlf true
- git config --global credential.helper store
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GitHubToken):x-oauth-basic@github.com`n"
- git config --global user.email "%GitHubUserEmail%"
- git config --global user.name "%GitHubUserName%"

install:
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
- bundle config --local path vendor/bundle
- gem install bundler --quiet --no-ri --no-rdoc
- gem install github_changelog_generator --quiet --no-ri --no-rdoc
- choco install gitversion.portable -pre -y
- ps: .\install-vsix-appveyor.ps1

Expand All @@ -147,7 +171,7 @@

nuget restore source\nanoFramework.Networking.Sntp.sln

gitversion /l console /output buildserver /updateAssemblyInfo /ensureassemblyinfo
C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools\GitVersion.exe /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.Runtime.Events\Properties\AssemblyInfo.cs"

build_script:
- ps: >-
Expand All @@ -164,28 +188,28 @@
name: Nuget_Packages

deploy:
# the provider is actually MyGet but works the same as NuGet
- provider: NuGet
server: https://www.myget.org/F/nanoframework-dev/api/v2/package
api_key:
secure: 0drE56FivPFYI3oVZWcVFTpjOXSqyjT6kGangIxFRcRLqMhV3lQHqUButuuiPM+N
skip_symbols: true
- provider: GitHub
tag: v$(GitVersion_NuGetVersionV2)
release: nanoFramework.Networking.Sntp Library v$(gitversion_semver)
description: '[CHANGELOG.md](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/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.Networking.Sntp/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Runtime.Events/blob/develop/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.Runtime.Events/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact: Nuget_Packages
draft: true
prerelease: true
force_update: true

before_deploy:
- ps: >-
.\commit-assemblyinfo-changes.ps1

.\generate-change-log.ps1

# requires APPVEYOR_DISCORD_WEBHOOK_URL enviroment variable set with Discord webhook URL
on_failure:
- ps: |

cd ..
cd $env:APPVEYOR_BUILD_FOLDER

.\appveyor-discord.ps1 failure $env:APPVEYOR_DISCORD_WEBHOOK_URL

Expand Down Expand Up @@ -223,14 +247,17 @@
test: off

environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
matrix:
- RUBY_VERSION: 24
GitHubUserName:
secure: 7OBtVAMTodMWK20wg6pGnQ==
GitHubUserEmail:
secure: HeABB68Sn/Lhbd69C2cUcfWv0ab/rMDEcOLvcxf8gGw=
secure: /NpmL1KqwHyHFnF0GlUovA586wDIt8Hg/Q8Dro6kUpk=
GitHubToken:
secure: WOqlCsnwTzfDPJFoNV/h8mEESIpG/9uFn1u6oE8hGZtXwIQQlsY+NyyLt9Y5xoFn
secure: i/2hGsqVMwzdM5yIS4rxOIeG3ftx7su7klWYN80s/fHvgk7A5H2fF3oUTNLcyTbw
GitRestAuth:
secure: E3bCMe4LtDdAhHSYRcLp0N6DixJe1m8TNxhYeJW/GnqM3WXdRqsgkHSbwootPjJQtOQJrps4twmzTVzofLSVgPgbzU8PxU0AkJV7zwkyVOE=

init:
- git config --global core.autocrlf true
Expand All @@ -244,7 +271,6 @@
- bundle config --local path vendor/bundle
- gem install bundler --quiet --no-ri --no-rdoc
- gem install github_changelog_generator --quiet --no-ri --no-rdoc
# - bundle install
- choco install gitversion.portable -pre -y
- ps: .\install-vsix-appveyor.ps1

Expand All @@ -255,46 +281,45 @@

nuget restore source\nanoFramework.Networking.Sntp.sln

gitversion /l console /output buildserver /updateAssemblyInfo /ensureassemblyinfo
C:\ProgramData\chocolatey\lib\GitVersion.Portable\tools\GitVersion.exe /l console /output buildserver /updateAssemblyInfo "source\nanoFramework.Runtime.Events\Properties\AssemblyInfo.cs"

build_script:
- ps: >-

msbuild source\nanoFramework.Networking.Sntp.sln /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

before_deploy:
# need this to keep ruby happy
- ps: md c:\tmp
- bundle exec github_changelog_generator --token %GitHubToken%
# add here the updated changelog and the updated assembly info files
- git add .
- git commit --amend --no-edit
on_success:
# for this environment variable to work here it has to be set in AppVeyor UI
- nuget push source\Nuget.nanoFramework.Runtime.Events\bin\Release\nanoFramework.Runtime.Events.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package
- nuget push source\Nuget.nanoFramework.Runtime.Events.DELIVERABLES\bin\Release\nanoFramework.Runtime.Events.DELIVERABLES.%GitVersion_NuGetVersionV2%.nupkg %MyGetToken% -Source https://www.myget.org/F/nanoframework-dev/api/v2/package

artifacts:
- path: '**\bin\Release\*.nupkg'
name: Nuget_Packages

deploy:
- provider: NuGet
api_key:
secure: NSRDXbS8tmzOy4wStGuO3yQMKI8Sk10vF8iQtz9ZDXEnHfwnuDdnXbr/Kno3MMvY
skip_symbols: true

- provider: GitHub
tag: v$(GitVersion_NuGetVersionV2)
release: nanoFramework.Networking.Sntp Library v$(gitversion_semver)
description: '[CHANGELOG.md](https://github.com/nanoframework/lib-nanoFramework.Networking.Sntp/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.Networking.Sntp/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
description: 'Check the [changelog](https://github.com/nanoframework/lib-nanoFramework.Runtime.Events/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\n:package: [.NET](https://www.myget.org/feed/nanoframework-dev/package/nuget/nanoFramework.Runtime.Events/$(GitVersion_NuGetVersionV2)) v$(GitVersion_NuGetVersionV2)'
auth_token:
secure: DNixoFFE+pGlwyhj7McfZoln42vOmj0iY1iNV9zXEr3y0NpXlOIgL8k5ehzlFM1S
artifact: Nuget_Packages
draft: true
prerelease: true
force_update: true

before_deploy:
- ps: >-
.\commit-assemblyinfo-changes.ps1

.\generate-change-log.ps1

# requires APPVEYOR_DISCORD_WEBHOOK_URL enviroment variable set with Discord webhook URL
on_failure:
- ps: |

cd ..
cd $env:APPVEYOR_BUILD_FOLDER

.\appveyor-discord.ps1 failure $env:APPVEYOR_DISCORD_WEBHOOK_URL

Expand Down
82 changes: 82 additions & 0 deletions commit-assemblyinfo-changes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# only need to commit assembly info changes when build is NOT for a pull-request
if ($env:appveyor_pull_request_number)
{
'Skip committing assembly info changes as this is a PR build...' | Write-Host -ForegroundColor White
}
else
{
# updated assembly info files
git add "source\nanoFramework.Networking.Sntp\Properties\AssemblyInfo.cs"
git commit -m "Update assembly info file for v$env:GitVersion_NuGetVersionV2"
git push origin --porcelain -q > $null

'Updated assembly info...' | Write-Host -ForegroundColor White -NoNewline
'OK' | Write-Host -ForegroundColor Green

# clone nf-interpreter repo (only a shallow clone with last commit)
git clone https://github.com/nanoframework/nf-interpreter -b develop --depth 1 -q
cd nf-interpreter

# new branch name
$newBranch = "$env:APPVEYOR_REPO_BRANCH-nfbot/update-version/nanoFramework.Networking.Sntp/$env:GitVersion_NuGetVersionV2"

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

# replace version in assembly declaration
$newVersion = $env:GitVersion_AssemblySemFileVer -replace "\." , ", "
$newVersion = "{ $newVersion }"

$versionRegex = "\{\s*\d+\,\s*\d+\,\s*\d+\,\s*\d+\s*}"
$assemblyFiles = (Get-ChildItem -Path ".\*" -Include "nf_networking_sntp.cpp" -Recurse)

foreach($file in $assemblyFiles)
{
$filecontent = Get-Content($file)
attrib $file -r
$filecontent -replace $versionRegex, $newVersion | Out-File $file -Encoding utf8
}

# check if anything was changed
$repoStatus = "$(git status --short --porcelain)"

if ($repoStatus -eq "")
{
# nothing changed
cd ..
}
else
{
$commitMessage = "Update nanoFramework.Networking.Sntp version to $env:GitVersion_AssemblySemFileVer"

# commit changes
git add -A 2>&1
git commit -m"$commitMessage" -m"[version update]" -q
git push --set-upstream origin "$newBranch" --porcelain -q > $null

# start PR
$prRequestBody = @{title="$commitMessage";body="$commitMessage`nStarted with https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT`n[version update]";head="$newBranch";base="develop"} | ConvertTo-Json
$githubApiEndpoint = "https://api.github.com/repos/nanoframework/nf-interpreter/pulls"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

try
{
$result = Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $githubApiEndpoint -Header @{"Authorization"="Basic $env:GitRestAuth"} -ContentType "application/json" -Body $prRequestBody
'Started PR with version update...' | Write-Host -ForegroundColor White -NoNewline
'OK' | Write-Host -ForegroundColor Green
}
catch
{
$result = $_.Exception.Response.GetResponseStream()
$reader = New-Object System.IO.StreamReader($result)
$reader.BaseStream.Position = 0
$reader.DiscardBufferedData()
$responseBody = $reader.ReadToEnd();

"Error starting PR: $responseBody" | Write-Host -ForegroundColor Red
}

# move back to home folder
& cd .. > $null
}
}
Loading