Skip to content

Commit ef97567

Browse files
committed
use proper xml parser to extract version
1 parent 1e46860 commit ef97567

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,21 @@ jobs:
2727
- name: Pack
2828
run: dotnet pack --configuration Release --no-build --output ./nupkg
2929

30+
- name: Install xmllint
31+
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
32+
3033
- name: Check if version exists on NuGet
3134
id: version-check
3235
run: |
3336
PACKAGE_ID="Facturapi"
34-
VERSION=$(grep -oPm1 "(?<=<Version>)[^<]+" facturapi-net.csproj)
35-
echo "Checking NuGet for $PACKAGE_ID $VERSION"
37+
VERSION=$(xmllint --xpath "string(//Project/PropertyGroup/Version)" facturapi-net.csproj)
38+
echo "Detected version: $VERSION"
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
3640
if curl -sSf "https://api.nuget.org/v3-flatcontainer/${PACKAGE_ID,,}/$VERSION/${PACKAGE_ID,,}.$VERSION.nupkg" > /dev/null; then
3741
echo "Version $VERSION already exists. Skipping push."
3842
echo "exists=true" >> $GITHUB_OUTPUT
3943
else
44+
echo "Version $VERSION does not exist. Proceeding with publish."
4045
echo "exists=false" >> $GITHUB_OUTPUT
4146
fi
4247

0 commit comments

Comments
 (0)