From a87916796c02b6caaae7bcf635a4989e5e1b08d8 Mon Sep 17 00:00:00 2001 From: Webster Date: Wed, 6 Dec 2023 23:12:49 +0000 Subject: [PATCH] #19 conditional build code --- .github/workflows/build.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7684463..2d2c85a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,13 +24,15 @@ jobs: - name: Setup GitHub NuGet run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Ian-Webster/index.json" - # Resource NuGet dependencies - - name: Restore dependencies - run: dotnet restore 'DataAccess.Repository' - - # Build project - - name: Build - run: dotnet build --configuration Release 'DataAccess.Repository' + - name: Check for Changes in Repository Project + run: | + if [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }} 'DataAccess.Repository/') ]]; then + echo "Changes detected in DataAccess.Repository project. Restoring packages and running build..." + dotnet restore 'DataAccess.Repository' + dotnet build --configuration Release 'DataAccess.Repository' + else + echo "No changes in DataAccess.Repository project. Skipping build." + fi build_HotChococlateExtension: @@ -52,10 +54,12 @@ jobs: - name: Setup GitHub NuGet run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Ian-Webster/index.json" - # Resource NuGet dependencies - - name: Restore dependencies - run: dotnet restore 'Extensions/DataAccess.Repository.HotChocolate' - - # Build project - - name: Build - run: dotnet build --configuration Release 'Extensions/DataAccess.Repository.HotChocolate' \ No newline at end of file + - name: Check for Changes in HotChocolate Project + run: | + if [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }} 'Extensions/DataAccess.Repository.HotChocolate/') ]]; then + echo "Changes detected in Extensions/DataAccess.Repository.HotChocolate project. Restoring packages and running build..." + dotnet restore 'xtensions/DataAccess.Repository.HotChocolate' + dotnet build --configuration Release 'Extensions/DataAccess.Repository.HotChocolate' + else + echo "No changes in Extensions/DataAccess.Repository.HotChocolate project. Skipping build." + fi \ No newline at end of file