name: Publish NuGet Packages on: push: tags: - '[0-9]+.[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+-*' jobs: build-and-publish: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.x' - name: Extract version from tag run: | VERSION=${GITHUB_REF##*/} echo "VERSION=$VERSION" >> $GITHUB_ENV echo "Publishing version: $VERSION" - name: Restore dependencies run: dotnet restore - name: Build solution run: dotnet build --configuration Release --no-restore - name: Pack Abstractions run: | dotnet pack Svrnty.GeoManagement.Abstractions/Svrnty.GeoManagement.Abstractions.csproj \ --configuration Release \ --no-build \ --output ./artifacts \ -p:Version=${{ env.VERSION }} - name: Pack Google Provider run: | dotnet pack Svrnty.GeoManagement.Google/Svrnty.GeoManagement.Google.csproj \ --configuration Release \ --no-build \ --output ./artifacts \ -p:Version=${{ env.VERSION }} - name: List packages run: ls -lh ./artifacts - name: Publish to NuGet.org run: | dotnet nuget push ./artifacts/*.nupkg \ --api-key ${{ secrets.NUGET_API_KEY }} \ --source https://api.nuget.org/v3/index.json \ --skip-duplicate