This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deploy.GitTag.msbuild
58 lines (50 loc) · 2.61 KB
/
Deploy.GitTag.msbuild
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Run"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Directories -->
<DirWorkspace>$(MSBuildProjectDirectory)</DirWorkspace>
<DirTools>$(DirWorkspace)\tools</DirTools>
<DirBuild>$(DirWorkspace)\build</DirBuild>
<DirBuildTemp>$(DirBuild)\temp</DirBuildTemp>
<!-- Version number -->
<VersionSemantic>0</VersionSemantic>
<!-- Tools -->
<MsBuildExtensionsPath>$(DirTools)\msbuild.extensions</MsBuildExtensionsPath>
</PropertyGroup>
<Import Project="$(MsBuildExtensionsPath)\FindToolFromPackages.msbuild"
Condition="Exists('$(MsBuildExtensionsPath)\FindToolFromPackages.msbuild')" />
<Import Project="$(MsBuildExtensionsPath)\GetSemanticVersion.msbuild"
Condition="Exists('$(MsBuildExtensionsPath)\GetSemanticVersion.msbuild')" />
<Target Name="Run" DependsOnTargets="_DisplayInfo;_LoadReleaseNotes;_TagRelease;" />
<!-- Display info -->
<Target Name="_DisplayInfo">
<Message Text="Tagging release ..." />
</Target>
<PropertyGroup>
<FileSemanticVersion>$(DirBuildTemp)\semantic_version.json</FileSemanticVersion>
</PropertyGroup>
<Target Name="_GetSemanticVersion" DependsOnTargets="_DisplayInfo;">
<GetSemanticVersion VersionFile="$(FileSemanticVersion)">
<Output TaskParameter="VersionSemantic" PropertyName="VersionSemantic" />
</GetSemanticVersion>
</Target>
<PropertyGroup>
<FileReleaseNotes>$(DirBuildTemp)\releasenotes_short.md</FileReleaseNotes>
</PropertyGroup>
<Target Name="_LoadReleaseNotes" DependsOnTargets="_DisplayInfo;_GetSemanticVersion;_LoadReleaseNotes">
<CreateProperty Condition="Exists('$(FileReleaseNotes)')" Value="$([System.IO.File]::ReadAllText('$(FileReleaseNotes)'))">
<Output TaskParameter="Value" PropertyName="ReleaseNotes" />
</CreateProperty>
</Target>
<PropertyGroup>
<ExeGit>$(DirGit)\git.exe</ExeGit>
</PropertyGroup>
<Target Name="_TagRelease" DependsOnTargets="_DisplayInfo;_GetSemanticVersion" Condition="Exists('$(DirGit)')" >
<Exec Command=""$(ExeGit)" tag -a -m "$(ReleaseNotes)" "$(VersionSemantic)""
WorkingDirectory="$(DirWorkspace)" />
<Exec Command=""$(ExeGit)" push origin --tags"
WorkingDirectory="$(DirWorkspace)" />
</Target>
</Project>