Skip to content

Commit

Permalink
DiligentCore.NET: Reworked script to parse the latest tag and automat…
Browse files Browse the repository at this point in the history
…ic publish new package
  • Loading branch information
MikhailGorobets committed Jul 29, 2023
1 parent a220fcb commit 8129422
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish-nuget-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- 'v*'
- 'API*'
workflow_dispatch:

env:
Expand Down
22 changes: 19 additions & 3 deletions BuildTools/.NET/dotnet-build-package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# ----------------------------------------------------------------------------

import os
import re
import json
import jsonschema
import shutil
Expand Down Expand Up @@ -168,12 +169,27 @@ def cmake_build_project(config, settings):

def get_latest_tag_without_prefix():
try:
output = subprocess.check_output(['git', 'tag', '--list', 'v*', '--sort=-v:refname'], encoding='utf-8')
output = subprocess.check_output(['git', 'tag', '--list', '--sort=-creatordate'], encoding='utf-8')
tags = output.strip().split('\n')
latest_tag = tags[0][1:] if tags else None
tag_lst = tags[0]
tag_api = next(filter(lambda item: item.startswith("API"), tags), None)
tag_ver = next(filter(lambda item: item.startswith("v"), tags), None)
if tag_lst.startswith("API"):
postfix_tag_api = tag_lst.lstrip("API")
postfix_tag_ver = tag_ver.lstrip("v").replace(".", "")
if postfix_tag_api.startswith(postfix_tag_ver):
postfix = postfix_tag_api[len(postfix_tag_ver):].lstrip("0")
result = f"{tag_ver[1:]}-{postfix}"
else:
raise Exception(f"Not expected tag: {tag_lst}")

elif tag_lst.startswith("v"):
result = tag_lst.lstrip("v")
else:
raise Exception(f"Not expected tag: {tag_lst}")
except subprocess.CalledProcessError as exc:
raise Exception(exc.output)
return latest_tag
return result


def dotnet_generate_version(path, is_local=True):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<PackageId>DiligentGraphics.DiligentEngine.Core</PackageId>
<Authors>Diligent Graphics</Authors>
<Company>Diligent Graphics</Company>
<!-- <Version>$(PackageGitVersion)</Version> -->
<Version>2.5.3-beta.11</Version>
<Version>$(PackageGitVersion)</Version>
<Description>A modern cross-platform low-level graphics library designed
to take full advantage of Direct3D12 and Vulkan, while supporting
older platforms via Direct3D11, OpenGL and OpenGLES.</Description>
Expand Down
2 changes: 1 addition & 1 deletion Tests/DiligentCoreTest.NET/DiligentCoreTest.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Diligent-GraphicsEngine.NET" Version="$(PackageGitVersion)" IsImplicitlyDefined="true" />
<PackageReference Include="DiligentGraphics.DiligentEngine.Core" Version="$(PackageGitVersion)" IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
Expand Down

0 comments on commit 8129422

Please sign in to comment.