Merge pull request #43 from Zastai/update-dependencies #27
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 | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
dotnet-version: 8.0.x | |
strategy: | |
matrix: | |
configuration: ['Debug', 'Release'] | |
steps: | |
- name: Check out the project | |
uses: actions/checkout@v4 | |
- name: Set up .NET ${{env.dotnet-version}} | |
uses: actions/setup-dotnet@v4 | |
id: setup | |
with: | |
dotnet-version: ${{env.dotnet-version}} | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Create global.json to force use of .NET SDK ${{steps.setup.outputs.dotnet-version}} | |
run: echo '{"sdk":{"version":"${{steps.setup.outputs.dotnet-version}}"}}' > ./global.json | |
- name: Run build script (${{matrix.configuration}}) | |
run: pwsh ./build-package.ps1 -ContinuousIntegration -WithBinLog -Configuration ${{matrix.configuration}} | |
- name: "Artifact: MSBuild Logs" | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: MSBuild Logs (${{matrix.configuration}}) | |
path: msbuild.*.binlog | |
- name: "Artifact: NuGet Packages" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NuGet Packages (${{matrix.configuration}}) | |
path: "output/package/${{matrix.configuration}}/*.*nupkg" | |
- name: Publish (NuGet - GitHub Packages) | |
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/v') | |
run: "dotnet nuget push output/package/${{matrix.configuration}}/*.nupkg -s https://nuget.pkg.github.com/zastai/index.json -k ${{secrets.GITHUB_TOKEN}}" | |
- name: Publish (NuGet - nuget.org) | |
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/v') | |
run: "dotnet nuget push output/package/${{matrix.configuration}}/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}" |