From 61b4e97a9beb2a1c2ff4b244d281e558a79e6e94 Mon Sep 17 00:00:00 2001 From: kubagdynia Date: Wed, 4 Sep 2024 22:44:35 +0200 Subject: [PATCH] Added publish workflow --- .github/workflows/publish.yaml | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..e749554 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,50 @@ +name: Publish Nuget package + +on: workflow_dispatch + +env: + working-directory: ./ + NuGetDirectory: ${{ github.workspace}}/nuget + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore + working-directory: ${{env.working-directory}} + + - name: Build the project + run: dotnet build --configuration Release --no-restore + working-directory: ${{env.working-directory}} + + - name: Run tests + run: dotnet test --configuration Release --no-build --verbosity normal + working-directory: ${{env.working-directory}} + + # Create the NuGet package in the folder from the environment variable NuGetDirectory + - name: Pack the NuGet package + run: dotnet pack ./CacheDrive --configuration Release --no-build --output ${{env.NuGetDirectory}} + working-directory: ${{env.working-directory}} + + # List the NuGet package + - name: List the NuGet package + run: ls ${{env.NuGetDirectory}} + + # Publish the NuGet package as an artifact, so it can be used in other workflows or in the following jobs + - name: Publish the NuGet package as an artifact + uses: actions/upload-artifact@v3 + with: + name: nuget + if-no-files-found: error + retention-days: 7 + path: ${{env.NuGetDirectory}}/*.nupkg + \ No newline at end of file