Updated the build steps #79
Workflow file for this run
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: Publish | |
on: | |
push: {} | |
pull_request: {} | |
release: | |
types: [published] | |
env: | |
Configuration: Release | |
ProjectDir: src\SourceGenerator.Foundations\ | |
ProjectName: SourceGenerator.Foundations.csproj | |
SolutionPath: src\SourceGenerator.Foundations.sln | |
MSBUILDDISABLENODEREUSE: '1' # Stops MSBuild from locking MSBuild nuget package | |
jobs: | |
test: | |
name: Test | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
project: | |
- name: SourceGenerator.Foundations.Tests | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Test | ${{ matrix.project.name }} | |
run: dotnet test ${{ matrix.project.name }} | |
publish: | |
name: build, bundle & publish | |
runs-on: windows-latest | |
needs: | |
- test | |
strategy: | |
matrix: | |
project: | |
- name: SourceGenerator.Foundations | |
- name: SourceGenerator.Foundations.Contracts | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} # checkout the correct branch name | |
fetch-depth: 0 # fetch the whole repo history | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore | |
run: dotnet tool restore | |
- name: GitVersion | |
run: dotnet gitversion /output buildserver | |
# Build | |
- name: Build | ${{ matrix.project.name }} | |
run: dotnet build src\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_SemVer}} | |
# Pack | |
- name: Pack | ${{ matrix.project.name }} | |
run: dotnet pack src\${{ matrix.project.name }}\${{ matrix.project.name }}.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_FullSemVer}} | |
# Release | |
- name: Push | ${{ matrix.project.name }} | |
if: github.event_name == 'release' | |
run: dotnet nuget push src\${{ matrix.project.name }}\bin\${{env.Configuration}}\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json |