Switched the env variables to scoped ones using env context #21
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: .NET Core Desktop | |
on: [ push, pull_request ] | |
#branches: [ "main" ] | |
# pull_request: | |
# branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SourceDir: ./src/ | |
Configuration: Release | |
Solution_Path: ./src/Extended.Collections.sln | |
# MSBuild defaults | |
NoBuild: true # Build once explictly | |
NoRestore: true # Restore once explictly | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore Dotnet Tools | |
run: dotnet tool restore | |
- name: Run Git Version | |
run: dotnet gitversion | |
- name: Restore | |
run: dotnet restore ${Solution_Path} -p:NoRestore=false | |
- name: Build | |
run: dotnet build ${Solution_Path} -p:Version=${{env.GitVersion_AssemblySemVer}} -p:NoBuild=false | |
- name: Execute unit tests | |
run: dotnet test ${Solution_Path} | |
- name: Pack | |
run: dotnet msbuild -t:pack ${Solution_Path} -p:PackageVersion=${{env.GitVersion_NuGetVersion}} | |
- name: Push | |
run: dotnet nuget push ./src/Extended.Collections/bin/${Configuration}/*.nupkg --skip-duplicate --api-key ${{secrets.NuGet_Api_Key}} --source ${{vars.Nuget_Source_Url}} |