Merge pull request #626 from microsoft/bugfix/remove-variables #1476
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 and run unit tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
- release | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest] # [ubuntu-latest, windows-latest, macOS-latest] | |
configuration: [Release, Debug] | |
env: | |
IsReleaseBuild: ${{ matrix.configuration == 'Release' && github.event_name == 'release' && !github.event.release.prerelease && github.ref == 'refs/heads/master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.0.x' | |
- name: Build with dotnet | |
run: dotnet build --configuration ${{ matrix.configuration }} | |
- name: Run Unit Tests | |
run: dotnet test --no-build --configuration ${{ matrix.configuration }} | |
- name: Create NuGet packages | |
run: dotnet pack --no-build --configuration ${{ matrix.configuration }} | |
- name: Add GitHub package source | |
run: dotnet nuget add source https://nuget.pkg.github.com/microsoft/index.json --name "github" --username NotUsed --password ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish NuGet packages | |
run: dotnet nuget push nuget\*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate --no-symbols true | |
if: matrix.configuration == 'Release' && github.event_name == 'release' && github.ref == 'refs/heads/master' |