From 167f23573e7e31df13e1424187d24a8db5aba8b3 Mon Sep 17 00:00:00 2001 From: senthil Date: Tue, 24 Dec 2024 08:43:38 +1300 Subject: [PATCH] Pack and release --- .github/workflows/release.yml | 51 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8594e5c..f3aa09e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,36 +1,31 @@ - -name: Release nuget package +name: Build and Release to NuGet on: workflow_dispatch: - inputs: - logLevel: - description: 'Log level' - required: true - default: 'warning' - type: choice - options: - - info - - warning - - debug - tags: - description: 'Test scenario tags' - required: false - type: boolean - environment: - description: 'Environment to run tests against' - type: environment - required: true jobs: - log-the-inputs: + release: runs-on: ubuntu-latest + steps: - - run: | - echo "Log level: $LEVEL" - echo "Tags: $TAGS" - echo "Environment: $ENVIRONMENT" + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 9.x + + - name: Restore dependencies + run: dotnet restore IpApi/IpApi.csproj + + - name: Build the project + run: dotnet build IpApi/IpApi.csproj --configuration Release --no-restore + + - name: Pack NuGet package + run: dotnet pack IpApi/IpApi.csproj --configuration Release --no-build --output ./nupkg + + - name: Publish to NuGet env: - LEVEL: ${{ inputs.logLevel }} - TAGS: ${{ inputs.tags }} - ENVIRONMENT: ${{ inputs.environment }} + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push "./nupkg/*.nupkg" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json