--- kind: pipeline type: docker name: litecharms-nuget-libraries steps: - name: build image: mcr.microsoft.com/dotnet/sdk:10.0 commands: - dotnet restore - dotnet build -c Release --no-restore - name: pack-and-publish image: mcr.microsoft.com/dotnet/sdk:10.0 environment: NEXUS_KEY: { from_secret: nexus_api_key } NEXUS_URL: https://nexus.khongisa.co.za/repository/nuget-hosted/ VERSION: 1.${DRONE_BUILD_NUMBER}.0 commands: # Abstractions - dotnet pack LiteCharms.Abstractions/LiteCharms.Abstractions.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Abstractions.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL # Models - dotnet pack LiteCharms.Models/LiteCharms.Models.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Models.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL # Infrastructure - dotnet pack LiteCharms.Infrastructure/LiteCharms.Infrastructure.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Infrastructure.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL # Features - dotnet pack LiteCharms.Features/LiteCharms.Features.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Features.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL # Extensions - dotnet pack LiteCharms.Extensions/LiteCharms.Extensions.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Extensions.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL # Entities - dotnet pack LiteCharms.Entities/LiteCharms.Entities.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Entities.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL - name: gitea-tag-release image: alpine/git environment: GITEA_TOKEN: { from_secret: git_token } GITEA_USER: { from_secret: git_username } GITEA_PASS: { from_secret: git_password } VERSION: 1.${DRONE_BUILD_NUMBER}.0 commands: - apk add --no-cache curl - git remote set-url origin https://$${GITEA_USER}:$${GITEA_PASS}@gitea.khongisa.co.za/litecharms/components.git - git tag $VERSION - git push origin $VERSION - | curl -X POST "https://gitea.khongisa.co.za/api/v1/repos/litecharms/components/releases" \ -H "Authorization: token $${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d "{ \"tag_name\": \"$VERSION\", \"target_commitish\": \"${DRONE_COMMIT_SHA}\", \"name\": \"Library Suite $VERSION\", \"body\": \"### Published NuGet Packages\nAll packages versioned as **$VERSION**:\n* LiteCharms.Abstractions\n* LiteCharms.Models\n* LiteCharms.Infrastructure\n* LiteCharms.Features\n* LiteCharms.Extensions\n* LiteCharms.Entities\n\n[View in Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\", \"draft\": false, \"prerelease\": false }" trigger: event: - pull_request