Skip to content
This repository was archived by the owner on Apr 28, 2018. It is now read-only.

Commit 6c1878b

Browse files
authored
Merge pull request #135 from Microsoft/experimental
Updating build mechanisms to work for tagging.
2 parents 61667b0 + 679dcb6 commit 6c1878b

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

appveyor.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '0.1.0.{build}'
1+
version: '{build}'
22
pull_requests:
33
do_not_increment_build_number: true
44
image: WMF 5
@@ -19,22 +19,22 @@ build_script:
1919
- ps: |
2020
$env:PATH = "c:\program files\dotnet;$env:PATH"
2121
22-
$version = $env:APPVEYOR_BUILD_VERSION
23-
if ($env:APPVEYOR_REPO_TAG -eq "true") {
24-
# Tags do not get build versions.
25-
$version = $version.Remove($version.LastIndexOf(".")) + ".0"
26-
}
27-
28-
# PowerShell does not support prerelease versions
29-
$psversion = $version.Split("-")[0]
30-
3122
$projectFile = "src\Docker.PowerShell\project.json"
3223
$project = Get-Content $projectFile -Raw | ConvertFrom-Json
33-
$project.version = $version
34-
ConvertTo-Json $project -Depth 100 | Out-File -Encoding UTF8 $projectFile
24+
$version = $project.version
25+
26+
# Tags do not get build versions.
27+
if ($env:APPVEYOR_REPO_TAG -ne "true") {
28+
$version += ".$($env:APPVEYOR_BUILD_VERSION.split("-")[0])"
29+
30+
# Update the project.json version to include the build number.
31+
$project.version = $version
32+
ConvertTo-Json $project -Depth 100 | Out-File -Encoding UTF8 $projectFile
33+
}
3534
35+
# Replace module manifest version.
3636
$manifest = "src\Docker.PowerShell\Docker.psd1"
37-
(Get-Content $manifest -Raw) -replace "ModuleVersion.+","ModuleVersion = '$psversion'" | Out-File $manifest
37+
(Get-Content $manifest -Raw) -replace "ModuleVersion.+","ModuleVersion = '$version'" | Out-File $manifest
3838
3939
Get-Content $projectFile
4040
Get-Content $manifest
@@ -43,7 +43,7 @@ build_script:
4343
- ps: dotnet publish -f net46 -o $pwd\bin\net46 -c Release $pwd\src\Docker.PowerShell
4444
- ps: dotnet publish -f netstandard1.6 -o $pwd\bin\netstandard1.6 -c Release $pwd\src\Docker.PowerShell
4545
- ps: New-ExternalHelp -Path src\Docker.PowerShell\Help -OutputPath bin\en-US
46-
- ps: nuget pack src/Docker.PowerShell/Docker.nuspec -BasePath bin -OutputDirectory bin -Symbols -Version $psversion
46+
- ps: nuget pack src/Docker.PowerShell/Docker.nuspec -BasePath bin -OutputDirectory bin -Symbols -Version $version
4747
test_script:
4848
- ps: Register-PSRepository -Name test -SourceLocation $pwd\bin
4949
- ps: Install-Module -Name Docker -Repository test -Force
@@ -54,6 +54,7 @@ test_script:
5454
}
5555
- ps: git checkout -- src/Docker.PowerShell/Docker.psd1
5656
- ps: git checkout -- src/Docker.PowerShell/project.json
57+
- ps: git checkout -- src/Docker.PowerShell/Docker.nuspec
5758
- ps: git config core.autocrlf true
5859
- ps: New-MarkdownHelp -Module Docker -OutputFolder src\Docker.PowerShell\Help -ErrorAction SilentlyContinue
5960
- ps: Update-MarkdownHelp -Path src\Docker.PowerShell\Help

src/Docker.PowerShell/Docker.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>Docker</id>
5-
<version>0.1.0.0</version>
5+
<version>0.0.0</version>
66
<authors>Microsoft</authors>
77
<owners>microsoft</owners>
88
<licenseUrl>https://raw.githubusercontent.com/Microsoft/Docker-PowerShell/master/LICENSE</licenseUrl>

src/Docker.PowerShell/Docker.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# Script module or binary module file associated with this manifest
1010
RootModule = "Docker.psm1"
1111

12-
# Version number of this module.
13-
ModuleVersion = '0.1.0.0'
12+
# Version number of this module. Gets replaced by appveyor at build time.
13+
ModuleVersion = '0.0.0'
1414

1515
# Minimum PowerShell version. This should match the reference assembly version
1616
# in project.json (we require 5.0 due to dependencies on parameter completion).

src/Docker.PowerShell/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.1.0-alpha",
2+
"version": "0.1.0",
33
"description": "Docker.PowerShell Cmdlet Library",
44
"dependencies": {
55
"Docker.DotNet.X509": "2.124.2",

0 commit comments

Comments
 (0)