Skip to content

Commit ae6503c

Browse files
committed
package version
1 parent 1d5a34c commit ae6503c

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,25 @@ jobs:
3232
with:
3333
dotnet-version: ${{ env.DOTNET_VERSION }}
3434

35-
- name: Extract version from Directory.Build.props
35+
- name: Extract evaluated package version
3636
id: version
3737
shell: bash
3838
run: |
3939
set -euo pipefail
40-
VERSION="$(python3 - <<'PY'
41-
import xml.etree.ElementTree as ET
40+
PROJECT_PATH="src/MarkdownLd.Kb/MarkdownLd.Kb.csproj"
41+
VERSION="$(dotnet msbuild "${PROJECT_PATH}" -nologo -getProperty:PackageVersion | tr -d '\r')"
4242
43-
root = ET.parse("Directory.Build.props").getroot()
44-
45-
def read(name: str) -> str:
46-
for element in root.iter():
47-
if element.tag.endswith(name) and element.text and element.text.strip():
48-
return element.text.strip()
49-
return ""
50-
51-
print(read("PackageVersion") or read("Version"))
52-
PY
53-
)"
43+
if [ -z "${VERSION}" ]; then
44+
VERSION="$(dotnet msbuild "${PROJECT_PATH}" -nologo -getProperty:Version | tr -d '\r')"
45+
fi
5446
5547
if [ -z "${VERSION}" ]; then
56-
echo "::error::Could not read <PackageVersion>/<Version> from Directory.Build.props"
48+
echo "::error::Could not evaluate PackageVersion/Version from ${PROJECT_PATH}"
5749
exit 1
5850
fi
5951
6052
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
61-
echo "Version from Directory.Build.props: ${VERSION}"
53+
echo "Resolved package version: ${VERSION}"
6254
6355
- name: Restore dependencies
6456
run: dotnet restore ${{ env.SOLUTION }}

0 commit comments

Comments
 (0)