Skip to content

Updated internal verison prefix #23

Updated internal verison prefix

Updated internal verison prefix #23

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build and Publish
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
env:
PACKAGE_PATH: ./nupkg
defaults:
run:
working-directory: src/
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Avoid shallow clone for Nerdbank.GitVersioning
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
# Install Nerdbank.GitVersioning
- name: Nerdback.GitVersion
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
setCommonVars: true
- name: Restore dependencies
run: dotnet restore --no-cache
- name: Build
run: dotnet build --configuration Release --no-restore -p:Version=${{ steps.nbgv.outputs.SemVer2 }}
- name: Pack
run: dotnet pack -c Release --no-build --no-restore -p:PackageVersion=${{ steps.nbgv.outputs.NuGetPackageVersion }}
- name: Create Release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.nbgv.outputs.SemVer2 }}
release_name: ${{ steps.nbgv.outputs.SemVer2 }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: Push to NuGet Gallery
run: dotnet nuget push ${{env.PACKAGE_PATH}}/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
if: github.event_name == 'push'