Skip to content

FAC-1936: add constants for tax, cancellation, and global invoice fie… #17

FAC-1936: add constants for tax, cancellation, and global invoice fie…

FAC-1936: add constants for tax, cancellation, and global invoice fie… #17

Workflow file for this run

name: Deploy to NuGet
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: |
dotnet test FacturapiTest/FacturapiTest.csproj --framework net6.0 --configuration Release --no-build
dotnet test FacturapiTest/FacturapiTest.csproj --framework net8.0 --configuration Release --no-build
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./nupkg
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Check if version exists on NuGet
id: version-check
run: |
PACKAGE_ID="Facturapi"
VERSION=$(xmllint --xpath "string(//Project/PropertyGroup/Version)" facturapi-net.csproj)
echo "Detected version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
if curl -sSf "https://api.nuget.org/v3-flatcontainer/${PACKAGE_ID,,}/$VERSION/${PACKAGE_ID,,}.$VERSION.nupkg" > /dev/null; then
echo "Version $VERSION already exists. Skipping push."
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Version $VERSION does not exist. Proceeding with publish."
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: NuGet login (OIDC)
id: login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish to NuGet
if: steps.version-check.outputs.exists == 'false'
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json