Skip to content

Commit e38f247

Browse files
committed
Improvements on CI & CD
Signed-off-by: José Simões <[email protected]>
1 parent 5020f5c commit e38f247

File tree

3 files changed

+49
-24
lines changed

3 files changed

+49
-24
lines changed

appveyor.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# configuration these branches
2-
branches:
3-
only:
4-
- master
5-
- /dev.*/
6-
- /release.*/
7-
- /v.*/
1+
# configuration for all branches
82

93
image: Visual Studio 2017
104

@@ -85,6 +79,11 @@ before_deploy:
8579
8680
Push-AppveyorArtifact $env:APPVEYOR_BUILD_FOLDER\source\Nuget.nanoFramework.Hardware.Esp32\bin\Release\nanoFramework.Hardware.Esp32.$env:GitVersion_NuGetVersionV2.nupkg
8781
82+
after_deploy:
83+
# for this environment variable to work here it has to be set in AppVeyor UI
84+
- 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
85+
- 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
86+
8887
# requires APPVEYOR_DISCORD_WEBHOOK_URL enviroment variable set with Discord webhook URL
8988
on_failure:
9089
- ps: |
@@ -122,6 +121,8 @@ for:
122121
draft: true
123122
prerelease: false
124123
force_update: true
124+
on:
125+
appveyor_repo_tag: false
125126

126127
-
127128
branches:
@@ -139,11 +140,8 @@ for:
139140
draft: true
140141
prerelease: true
141142
force_update: true
142-
143-
after_deploy:
144-
# for this environment variable to work here it has to be set in AppVeyor UI
145-
- 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
146-
- 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
143+
on:
144+
appveyor_repo_tag: false
147145

148146
-
149147
branches:
@@ -166,3 +164,5 @@ for:
166164
draft: true
167165
prerelease: true
168166
force_update: true
167+
on:
168+
appveyor_repo_tag: false

commit-assemblyinfo-changes.ps1

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
# only need to commit assembly info changes when build is NOT for a pull-request
2-
if ($env:appveyor_pull_request_number)
1+
# Copyright (c) 2018 The nanoFramework project contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
# skip updating assembly info changes if build is a pull-request or not a tag (master OR release)
5+
if ($env:appveyor_pull_request_number -or
6+
($env:APPVEYOR_REPO_BRANCH -eq "master" -and $env:APPVEYOR_REPO_TAG -eq 'true') -or
7+
($env:APPVEYOR_REPO_BRANCH -match "^release*" -and $env:APPVEYOR_REPO_TAG -eq 'true') -or
8+
$env:APPVEYOR_REPO_TAG -eq "true")
39
{
4-
'Skip committing assembly info changes as this is a PR build...' | Write-Host -ForegroundColor White
10+
'Skip committing assembly info changes...' | Write-Host -ForegroundColor White
511
}
612
else
713
{
@@ -12,6 +18,12 @@ else
1218

1319
'Updated assembly info...' | Write-Host -ForegroundColor White -NoNewline
1420
'OK' | Write-Host -ForegroundColor Green
21+
}
22+
23+
# update assembly info in nf-interpreter if we are in development branch or if this is tag (master OR release)
24+
if ($env:APPVEYOR_REPO_BRANCH -match "^dev*" -or $env:APPVEYOR_REPO_TAG -eq "true")
25+
{
26+
'Updating assembly version in nf-interpreter...' | Write-Host -ForegroundColor White -NoNewline
1527

1628
# clone nf-interpreter repo (only a shallow clone with last commit)
1729
git clone https://github.com/nanoframework/nf-interpreter -b develop --depth 1 -q
@@ -51,7 +63,7 @@ else
5163

5264
# commit changes
5365
git add -A 2>&1
54-
git commit -m"$commitMessage" -m"[version update]" -q
66+
git commit -m"$commitMessage [skip ci]" -m"[version update]" -q
5567
git push --set-upstream origin "$newBranch" --porcelain -q > $null
5668

5769
# start PR

generate-change-log.ps1

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1-
# generate change log when build is NOT for a pull-request
2-
if ($env:appveyor_pull_request_number)
1+
# Copyright (c) 2018 The nanoFramework project contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
# generate change log when build is NOT a pull-request or not a tag (master OR release)
5+
if ($env:appveyor_pull_request_number -or
6+
($env:APPVEYOR_REPO_BRANCH -eq "master" -and $env:APPVEYOR_REPO_TAG -eq 'true') -or
7+
($env:APPVEYOR_REPO_BRANCH -match "^release*" -and $env:APPVEYOR_REPO_TAG -eq 'true') -or
8+
$env:APPVEYOR_REPO_TAG -eq "true")
39
{
4-
'Skip change log processing as this is a PR build...' | Write-Host -ForegroundColor White
10+
'Skip change log processing...' | Write-Host -ForegroundColor White
511
}
612
else
713
{
814
# need this to keep ruby happy
915
md c:\tmp
1016

11-
# generate change log
12-
# version includes commits
13-
bundle exec github_changelog_generator --token $env:GitHubToken
17+
if ($env:APPVEYOR_REPO_BRANCH -eq "master" -or $env:APPVEYOR_REPO_BRANCH -match "^release*")
18+
{
19+
# generate change log including future version
20+
bundle exec github_changelog_generator --token $env:GitHubToken --future-release "v$env:GitVersion_MajorMinorPatch"
21+
}
22+
else
23+
{
24+
# generate change log
25+
# version includes commits
26+
bundle exec github_changelog_generator --token $env:GitHubToken
27+
}
1428

1529
# updated changelog and the updated assembly info files
1630
git add CHANGELOG.md
1731
git commit -m "Update CHANGELOG for v$env:GitVersion_NuGetVersionV2"
18-
# need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr
19-
git push origin --porcelain | Write-Host
32+
git push origin --porcelain -q > $null
2033
}

0 commit comments

Comments
 (0)