|
| 1 | +# This workflow will run automatic builds for checkins to feature branches |
| 2 | +# It runs automtatically for branches that are not main, or release-* branches (including prerelease) |
| 3 | + |
| 4 | +name: Keyfactor - Build .NET Solution |
| 5 | + |
| 6 | +on: |
| 7 | + push: # build on push |
| 8 | + # don't run on push to main or release branches |
| 9 | + branches-ignore: |
| 10 | + - 'main' |
| 11 | + - 'release-**' |
| 12 | + pull_request: # also build on PRs to pre-release |
| 13 | + branches: |
| 14 | + - 'release-[0-9]+.[0-9]+-pre' |
| 15 | + workflow_dispatch: # allow manual runs |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: windows-latest |
| 20 | + steps: |
| 21 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Setup Envrionment |
| 25 | + id: setup_env |
| 26 | + run: | |
| 27 | + echo "Setup Envrionment Variables for Workflow" |
| 28 | + echo "Working Path: ${Env:GITHUB_WORKSPACE}" |
| 29 | + $slnPath = (Get-ChildItem -Include *.sln -File -Recurse).fullname |
| 30 | + echo "Solution File Path: ${slnPath}" |
| 31 | + echo "SOLUTION_PATH=${slnPath}" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append |
| 32 | + |
| 33 | + - uses: actions/setup-dotnet@v1 |
| 34 | + with: |
| 35 | + dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel |
| 36 | + #dotnet-version: |
| 37 | + |
| 38 | + - name: Add Package Source |
| 39 | + run: | |
| 40 | + dotnet nuget add source https://nuget.pkg.github.com/Keyfactor/index.json -n github -u ${{ github.actor }} -p ${{ secrets.BUILD_PACKAGE_ACCESS }} --store-password-in-clear-text |
| 41 | + |
| 42 | + # Configures msbuild path envrionment |
| 43 | + - name: setup-msbuild |
| 44 | + uses: microsoft/setup-msbuild@v1 |
| 45 | + |
| 46 | + # Restores Packages to Local Machine |
| 47 | + - name: restore nuget packages |
| 48 | + run: | |
| 49 | + nuget restore ${{ env.SOLUTION_PATH }} |
| 50 | + |
| 51 | + # Runs a set of commands using the runners shell |
| 52 | + - name: Execute MSBuild Commands |
| 53 | + run: | |
| 54 | + MSBuild.exe $Env:SOLUTION_PATH -p:RestorePackagesConfig=true -p:Configuration=Release |
| 55 | + |
0 commit comments