-
Notifications
You must be signed in to change notification settings - Fork 2
/
appveyor.yml
60 lines (47 loc) · 1.91 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
image: Visual Studio 2019
version: 1.0.0.{build}
branches:
only:
- main
skip_commits:
message: /updated? readme.*s/
environment:
nugetapikey:
secure: 5F/InX2bLI4XueEUzVqXPvQQFEW4GDZw6k/gtaVbZYLZYDSdWRIjf0MkexqdYemF
build: false
install:
- pwsh: |
Install-Module Configuration, ModuleBuilder, Pester, PSScriptAnalyzer -Force -SkipPublisherCheck
Set-Location $env:APPVEYOR_BUILD_FOLDER
- ps: |
Install-Module Pester, PSScriptAnalyzer -Force -SkipPublisherCheck
Set-Location $env:APPVEYOR_BUILD_FOLDER
build_script:
- pwsh: |
.\build.ps1 -TaskName Clean, Build
test_script:
- ps: .\build.ps1 -TaskName Test
- pwsh: .\build.ps1 -TaskName Test
on_success:
- ps: |
$tagVersion = (git describe --tags --abbrev=0 2>$null) -replace "^v" -as [Version]
$shouldPublish = $env:APPVEYOR_REPO_BRANCH -in 'master', 'main' -and
$tagVersion -and
-not $env:APPVEYOR_PULL_REQUEST_NUMBER
if ($shouldPublish) {
$moduleManifestPath = Join-Path -Path $env:APPVEYOR_BUILD_FOLDER -ChildPath 'build\*\*\*.psd1' |
Get-Item |
Where-Object { $_.BaseName -eq $_.Directory.Parent.Name }
$moduleManifest = Import-PowerShellDataFile -Path $moduleManifestPath.FullName
$buildVersion = $moduleManifest['ModuleVersion'] -as [Version]
if ($tagVersion -eq $buildVersion) {
$galleryModule = Find-Module $moduleManifestPath.BaseName -ErrorAction SilentlyContinue
if (-not $galleryModule -or $buildVersion -gt $galleryModule.Version) {
.\build.ps1 -TaskName Publish
} else {
Write-Host ('Skipping publish: {0} is already published' -f $buildVersion) -ForegroundColor Green
}
} else {
Write-Host ('Skipping publish: Tag {0} does not match build version {1}' -f $tagVersion, $buildVersion)
}
}