Skip to content

Update build.yml

Update build.yml #79

Workflow file for this run

name: Build
env:
ARTIFACT: SAM
PACKAGES: ${{ github.workspace }}\.nuget\packages
on:
workflow_call:
workflow_dispatch:
push:
branches: [ "main", "master" ]
tags-ignore:
- v*
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
pull_request:
branches: [ "main", "master" ]
concurrency:
group: ${{ github.workflow }}
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: Restore dependencies
run: dotnet restore .\src\SAM.sln --packages ${{ env.PACKAGES }}
- id: cache-save
uses: actions/cache/save@v4
if: steps.cache-restore.outputs.cache-hit != 'true'
with:
path: ${{ env.PACKAGES }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Publish
run: dotnet publish .\src\SAM\SAM.csproj -c Debug -a x86 -o publish --no-restore
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}
path: publish
if-no-files-found: error