Skip to content

Commit

Permalink
#19 conditional build code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian-Webster committed Dec 6, 2023
1 parent 42ebbc5 commit a879167
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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'
- 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

0 comments on commit a879167

Please sign in to comment.