Skip to content

Commit

Permalink
Added publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kubagdynia committed Sep 4, 2024
1 parent ed41eb3 commit 61b4e97
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 61b4e97

Please sign in to comment.