Tidied up a bit #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Publish | |
on: | |
push: | |
branches: [ main, master ] | |
tags: [ v* ] | |
env: | |
buildConfiguration: Release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup GitVersion | |
uses: gittools/actions/gitversion/setup@v0.10.2 | |
with: | |
versionSpec: 5.x | |
- name: Execute GitVersion | |
uses: gittools/actions/gitversion/execute@v0.10.2 | |
id: gitversion | |
with: | |
additionalArguments: /output BuildServer | |
useConfigFile: true | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c ${{ env.buildConfiguration }} --no-restore -p:Version=${{ steps.gitversion.outputs.nuGetVersion }} -p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} -p:AssemblyVersion=1.0.0.0 | |
- name: Test | |
run: dotnet test -c ${{ env.buildConfiguration }} --no-build -v normal --filter FullyQualifiedName!~IntegrationTests | |
- name: Pack | |
run: dotnet pack -c ${{ env.buildConfiguration }} -p:PackageOutputPath="${{ github.workspace }}/artifacts/" -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }} | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nuget | |
path: | | |
${{ github.workspace }}/artifacts/*.nupkg | |
${{ github.workspace }}/artifacts/*.snupkg | |
- name: Push | |
uses: lethek/os-specific-run@v1.0.6 | |
with: | |
linux: dotnet nuget push "${{ github.workspace }}/artifacts/*.nupkg" -s ${{ secrets.NUGET_SOURCE }} -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
windows: dotnet nuget push "${{ github.workspace }}\artifacts\*.nupkg" -s ${{ secrets.NUGET_SOURCE }} -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate |