Skip to content

Updated workflows.

Updated workflows. #7

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build
env:
ARTIFACT: SAM
PACKAGES: ${{ github.workspace }}\.nuget\packages
on:
workflow_call:
workflow_dispatch:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
checkout:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
setup:
runs-on: windows-latest
needs: [checkout]
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
restore:
runs-on: windows-latest
needs: [setup]
steps:
- id: cache-restore
uses: actions/cache/restore@v3
with:
path: ${{ env.PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore .\src\SAM.sln --packages ${{ env.PACKAGES }}
- id: cache-save
uses: actions/cache/save@v3
with:
path: ${{ env.PACKAGES }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
publish:
runs-on: windows-latest
needs: [restore]
steps:
- name: Publish
run: dotnet publish .\src\SAM\SAM.csproj -c Debug -a x86 -o publish --no-restore
upload:
runs-on: windows-latest
needs: [publish]
steps:
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
with:
name: ${{ env.ARTIFACT }}
path: publish
if-no-files-found: error