Release build on master/main #12
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: Release build on master/main | |
on: | |
workflow_dispatch: | |
branches: [master] | |
paths: "src/**" | |
push: | |
branches: [master] | |
paths: "src/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fetch all history for all tags and branches | |
run: git fetch --prune --unshallow | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.8.x" | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: "8.0.x" | |
- name: Install dependencies | |
run: dotnet restore src | |
- name: Use GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Display the version | |
run: | | |
echo "Version: ${{ steps.gitversion.outputs.semVer }}" | |
- name: Build | |
run: | | |
dotnet build src --configuration Release --no-restore -p:version=${{ steps.gitversion.outputs.semVer }} | |
- name: Unit & integration test | |
run: | | |
dotnet test src --configuration Release --no-restore -p:version=${{ steps.gitversion.outputs.semVer }} | |
- name: Collect Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: nuget-packages | |
path: "**/*.nupkg" | |
- name: Publish the package to NuGet.Org | |
run: dotnet nuget push "**/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.PUBLISH_NUGET_ORG }} --skip-duplicate |