Skip to content

Commit

Permalink
Refactored condition checks in GitHub workflow
Browse files Browse the repository at this point in the history
- Updated the conditional statements in the GitHub workflow file to correctly reference the `change_detection` step.
- This change affects all tasks that rely on this condition, ensuring they only run when changes are detected.
- The affected tasks include dotnet installation, gitversion setup and execution, nuget caching, dotnet restore/build/test operations, test reporting, and artifact gathering/uploading.
  • Loading branch information
winromulus committed Jun 15, 2024
1 parent 8e7f7fa commit 223dc9e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ jobs:
- name: tools - dotnet - install
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: tools - gitversion - install
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
preferLatestVersion: true

- name: tools - gitversion - execute
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: GitVersion.yaml

- name: cache - nuget
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: actions/cache@v4
with:
path: ~/.nuget/packages
Expand All @@ -72,36 +72,36 @@ jobs:
${{ runner.os }}-nuget-
- name: dotnet restore
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
shell: bash
run: dotnet restore

- name: dotnet build
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
shell: bash
run: dotnet build --no-restore --configuration Release /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}}

- name: dotnet test
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
shell: bash
run: dotnet test --no-build --configuration Release --verbosity normal

- name: test-reporter
uses: dorny/test-reporter@v1
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
with:
name: Test Results
path: .artifacts/TestResults/*.trx
reporter: dotnet-trx

- name: artifacts - nuget - gather
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
run: |
mkdir -p .artifacts/nuget
find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \;
- name: artifacts - nuget - upload
if: ${{ change_detection.outputs.build == 'true' }}
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-nuget
Expand Down

0 comments on commit 223dc9e

Please sign in to comment.