Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Merge pull request #24 from AngeloDotNet/6-status-code-management-422 #13

Merge pull request #24 from AngeloDotNet/6-status-code-management-422

Merge pull request #24 from AngeloDotNet/6-status-code-management-422 #13

name: Build and Pack on Github and Nuget
on:
push:
branches: [ main ]
paths: [ 'src/CustomLibrary.ProblemDetails/**' ]
workflow_dispatch:
env:
NET_VERSION: '6.x'
PROJECT_NAME: src/CustomLibrary.ProblemDetails
PROJECT_FILE: CustomLibrary.ProblemDetails.csproj
RELEASE_NAME: CustomLibrary.ProblemDetails
jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET Core SDK ${{ env.NET_VERSION }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.NET_VERSION }}
- name: Nerdbank.GitVersioning
uses: dotnet/nbgv@v0.4
id: nbgv
with:
path: ${{ env.PROJECT_NAME }}
- name: Package
run: dotnet pack -c Release -o . '${{ env.PROJECT_NAME }}/${{ env.PROJECT_FILE }}' -p:Version=${{ steps.gitversion.outputs.SemVer }}
- name: Publish on NuGet
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate
- name: Publish on GitHub
run: |
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push **\*.nupkg --source github --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.nbgv.outputs.NuGetPackageVersion }}
release_name: ${{ env.RELEASE_NAME }} ${{ steps.nbgv.outputs.NuGetPackageVersion }}
draft: false
prerelease: false