Skip to content

Commit

Permalink
Publish prerelease versions
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Feb 23, 2018
1 parent 3dd4c85 commit 4a6be05
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
14 changes: 11 additions & 3 deletions appveyor.yml
Expand Up @@ -50,22 +50,31 @@ artifacts:

deploy:
- provider: GitHub
description: 'Release of version $(appveyor_build_version)'
description: 'Release version $(appveyor_build_version)'
auth_token:
secure: 5K94QY8dHKlbjvlBpQaXwAkmDf+LQE3g5WlU9snnNMjDjf0UT4xDoOBCLWcmwZOm
artifact: installer, package
on:
branch: master
configuration: Release

- provider: GitHub
description: 'Prerelease version $(appveyor_build_version)'
prerelease: true
auth_token:
secure: 5K94QY8dHKlbjvlBpQaXwAkmDf+LQE3g5WlU9snnNMjDjf0UT4xDoOBCLWcmwZOm
artifact: installer, package
on:
branch: develop
configuration: Release

- provider: NuGet
server: https://powershellgallery.com
api_key:
secure: 4STrzCp6wDsDBj/wCtmImMVL7wUI8DCGjdMBXGqQf9JZJ8LjmW5YSY8wtcHAv0XW
artifact: package
skip_symbols: true
on:
branch: master
configuration: Release

- provider: NuGet
Expand All @@ -74,5 +83,4 @@ deploy:
secure: WPxjuSouwbCdM6I771BfIbOk8gA883+l9RKUCfFknaUT1vYPmTpT2ABF9r+J0JgR
artifact: /.*\.symbols\.nupkg/
on:
branch: master
configuration: Release
2 changes: 1 addition & 1 deletion inc/TextTemplating.targets
Expand Up @@ -33,7 +33,7 @@
</ItemGroup>
</Target>

<Target Name="Transform" Condition="'$(TransformOnBuild)'=='true'" DependsOnTargets="$(BeforeTransform);GetTransforms" AfterTargets="BeforeBuild" Inputs="@(Transforms)" Outputs="%(Transforms.OutputFilePath)">
<Target Name="Transform" Condition="'$(TransformOnBuild)'=='true'" DependsOnTargets="$(BeforeTransform);GetTransforms" AfterTargets="BeforeBuild" Inputs="@(Transforms)" Outputs="@(Transforms->'%(OutputFilePath)')">
<Error Text="The TextTransform.exe executable was not found." Condition="!Exists('$(ExecutablePath)')" />

<PropertyGroup>
Expand Down
13 changes: 12 additions & 1 deletion src/PowerShell/MSI.tt
Expand Up @@ -10,6 +10,16 @@
{
moduleVersion = new Version(1, 0);
}

string prerelease = Host.ResolveParameterValue("", "", "Prerelease");
string commitIdShort = Host.ResolveParameterValue("", "", "CommitIdShort");
string publicRelease = Host.ResolveParameterValue("", "", "PublicRelease");

bool isPublicRelease = false;
if (string.IsNullOrEmpty(prerelease) && bool.TryParse(publicRelease, out isPublicRelease) && !isPublicRelease)
{
prerelease = "-g" + commitIdShort;
}
#>
# The MIT License (MIT)
#
Expand Down Expand Up @@ -95,6 +105,7 @@ PrivateData = @{
ProjectUri = 'https://github.com/heaths/psmsi'
LicenseUri = 'https://raw.githubusercontent.com/heaths/psmsi/master/LICENSE.txt'
IconUri = 'https://raw.githubusercontent.com/heaths/psmsi/master/res/psmsi.png'
}
<# if (!string.IsNullOrEmpty(prerelease)) { #> Prerelease = '<#= prerelease #>'
<# } #> }
}
}
20 changes: 16 additions & 4 deletions src/PowerShell/PowerShell.csproj
Expand Up @@ -195,17 +195,29 @@
<Target Name="CalculateVersion" DependsOnTargets="GetBuildVersion" AfterTargets="GenerateAssemblyVersionInfo">
<ItemGroup>
<T4ParameterValues Include="PackageVersion">
<Value>$(BuildVersion)</Value>
<Value>$(BuildVersionSimple)</Value>
<Visible>false</Visible>
</T4ParameterValues>
<T4ParameterValues Include="Prerelease">
<Value>$(PrereleaseVersion)</Value>
<Visible>false</Visible>
</T4ParameterValues>
<T4ParameterValues Include="CommitIdShort">
<Value>$(GitCommitIdShort)</Value>
<Visible>false</Visible>
</T4ParameterValues>
<T4ParameterValues Include="PublicRelease">
<Value>$(PublicRelease)</Value>
<Visible>false</Visible>
</T4ParameterValues>
</ItemGroup>
</Target>
<Target Name="BuildPackage" DependsOnTargets="CalculateVersion" Inputs="$(TargetPath);$(MSBuildProjectName).nuspec" Outputs="$(OutputPath)MSI.$(BuildVersion).nupkg">
<Target Name="BuildPackage" DependsOnTargets="CalculateVersion" Inputs="$(TargetPath);$(MSBuildProjectName).nuspec" Outputs="$(OutputPath)MSI.$(BuildVersionSimple).nupkg">
<PropertyGroup>
<ProjectPath>$(MSBuildProjectDirectory)\$(MSBuildProjectName).nuspec</ProjectPath>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "SolutionDir=$(SolutionDir);Configuration=$(Configuration);Platform=$(Platform);Version=$(BuildVersion)" -OutputDirectory "$(OutputPath.TrimEnd('\'))" -Symbols -NonInteractive -NoPackageAnalysis</BuildCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "SolutionDir=$(SolutionDir);Configuration=$(Configuration);Platform=$(Platform);Version=$(BuildVersionSimple)" -OutputDirectory "$(OutputPath.TrimEnd('\'))" -Symbols -NonInteractive -NoPackageAnalysis</BuildCommand>
</PropertyGroup>
<Exec Command="$(BuildCommand)" Outputs="$(OutputPath)MSI.$(BuildVersion).nupkg">
<Exec Command="$(BuildCommand)" Outputs="$(OutputPath)MSI.$(BuildVersionSimple).nupkg">
<Output TaskParameter="Outputs" ItemName="FileWrites" />
</Exec>
</Target>
Expand Down

0 comments on commit 4a6be05

Please sign in to comment.