-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.ps1
48 lines (34 loc) · 1.38 KB
/
build.ps1
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
#---------------------------------#
# Header #
#---------------------------------#
Write-Host 'Build Information:' -ForegroundColor Yellow
#Get current module version from manifest
$ManifestPath = Join-Path "$pwd" $(Join-Path "$env:APPVEYOR_PROJECT_NAME" "$env:APPVEYOR_PROJECT_NAME.psd1")
$CurrentVersion = (Import-PowerShellDataFile $ManifestPath).ModuleVersion
#display module information
Write-Host "ModuleName : $env:APPVEYOR_PROJECT_NAME"
Write-Host "Build version : $env:APPVEYOR_BUILD_VERSION"
Write-Host "Manifest version : $CurrentVersion"
Write-Host "Author : $env:APPVEYOR_REPO_COMMIT_AUTHOR"
Write-Host "Branch : $env:APPVEYOR_REPO_BRANCH"
#---------------------------------#
# BuildScript #
#---------------------------------#
#---------------------------------#
# Update module manifest #
#---------------------------------#
if($CurrentVersion -eq $env:APPVEYOR_BUILD_VERSION) {
Write-Host "No build tasks required... skipping"
}
else {
Write-Host "Updating Manifest Version to $env:APPVEYOR_BUILD_VERSION"
Try {
#Replace version in manifest with build version from appveyor
((Get-Content $ManifestPath).replace("= '$($currentVersion)'", "= '$($env:APPVEYOR_BUILD_VERSION)'")) |
Set-Content $ManifestPath -ErrorAction Stop
}
Catch {
Write-Warning "Manifest Update failed."
throw $_
}
}