diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cafd9e7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4.0.0 + + - name: Restore tools + run: dotnet tool restore + + - name: Restore dependencies + run: dotnet restore + working-directory: ./src + + - name: Build + run: dotnet build --configuration Release --no-restore + working-directory: ./src diff --git a/.github/workflows/deployment.yml b/.github/workflows/release.yml similarity index 64% rename from .github/workflows/deployment.yml rename to .github/workflows/release.yml index 1c91d0a..8ab1dbb 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/release.yml @@ -1,36 +1,39 @@ -name: Nuget-Publish +name: Release Package on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + release: + types: [ published ] jobs: build: runs-on: ubuntu-latest + permissions: + contents: write + steps: - name: Check out - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4.0.0 - with: - dotnet-version: 6.0.300 + - name: Restore tools run: dotnet tool restore + - name: Restore dependencies run: dotnet restore working-directory: ./src + - name: Build run: dotnet build --configuration Release --no-restore working-directory: ./src + - name: Pack - run: dotnet pack --configuration Release --no-build --output . + run: dotnet pack --no-build -p:PackageVersion=${{ github.ref_name }} -p:PackageReleaseNotes=${{ github.event.release.html_url }} --output . working-directory: ./src - if: ${{ github.ref == 'refs/heads/main' }} + - name: Publish run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json working-directory: ./src - if: ${{ github.ref == 'refs/heads/main' }}