Skip to content

Commit

Permalink
generating assembly version from last annotated tag and git rev-list
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilPepper committed Dec 9, 2020
1 parent 5c7cd96 commit af7752f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build-release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
run: |
GIT_TAG=$(git describe --first-parent --abbrev=0)
REV_COUNT=$(git rev-list $GIT_TAG..HEAD --count)
echo "git_tag=$GIT_TAG.$REV_COUNT" >> $GITHUB_ENV
echo "::set-output name=git_tag::$GIT_TAG.$REV_COUNT"
- name: Setup MSBuild.exe
Expand All @@ -58,7 +60,10 @@ jobs:

- name: Build the apps
shell: pwsh
run: msbuild $env:Project_Name.sln -m /p:Configuration=$env:Configuration
run: |
$version=$env:git_tag.substring(1)
echo $version
msbuild $env:Project_Name.sln -m /p:Configuration=$env:Configuration,VersionNumber=$version
env:
Configuration: ${{ matrix.configuration }}

Expand Down
8 changes: 8 additions & 0 deletions MHWItemBoxTracker/MHWItemBoxTracker.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Target Name="BeforeBuild" >
<Message Text="Updating AssemblyInfo to Version $(VersionNumber)"></Message>
<Message Text="Writing to AssemblyInfo files in $(SolutionRoot)"></Message>
<AssemblyInfo AssemblyVersion="$(VersionNumber)"
AssemblyFileVersion="$(VersionNumber)"
>
</AssemblyInfo>
</Target>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down
4 changes: 2 additions & 2 deletions MHWItemBoxTracker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.0.0")]
// [assembly: AssemblyFileVersion("1.0.0.0")]

0 comments on commit af7752f

Please sign in to comment.