Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ on:
default: false
type: boolean

publishWhichNuget:
description: 'Which Nuget ?'
required: true
default: 'Only Changed'
type: choice
options:
- Only Changed
- All

jobs:
build:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.gitversion.outputs.semVer }}
fullsemver: ${{ steps.gitversion.outputs.fullSemVer }}
nugetversion: ${{ steps.gitversion.outputs.fullSemVer }}

publishNuget: ${{ steps.changes.outputs.BddfyUpdated == 'true' || steps.changes.outputs.SamplesUpdated == 'true' || github.event.inputs.publishWhichNuget == 'All' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
Expand Down Expand Up @@ -147,13 +156,15 @@ jobs:
- name: Check for changes in project paths
id: changes
run: |
if git diff --quiet origin/main HEAD -- src/Samples/; then
latestTag=$(git describe --tags --abbrev=0)

if git diff --quiet "$latestTag" HEAD -- src/Samples/; then
echo "SamplesUpdated=false" >> $GITHUB_OUTPUT
else
echo "SamplesUpdated=true" >> $GITHUB_OUTPUT
fi

if git diff --quiet origin/main HEAD -- src/TestStack.BDDfy/; then
if git diff --quiet "$latestTag" HEAD -- src/TestStack.BDDfy/; then
echo "BddfyUpdated=false" >> $GITHUB_OUTPUT
else
echo "BddfyUpdated=true" >> $GITHUB_OUTPUT
Expand All @@ -166,7 +177,7 @@ jobs:

- name: Create Samples package
working-directory: src
if: steps.changes.outputs.SamplesUpdated == 'true'
if: steps.changes.outputs.SamplesUpdated == 'true' || github.event.inputs.publishWhichNuget == 'All'
run: >-
dotnet pack ./Samples/TestStack.BDDfy.Samples/*.csproj
--configuration Release
Expand All @@ -176,7 +187,7 @@ jobs:

- name: Create Bddfy package
working-directory: src
if: steps.changes.outputs.BddfyUpdated == 'true'
if: steps.changes.outputs.BddfyUpdated == 'true' || github.event.inputs.publishWhichNuget == 'All'
run: >-
dotnet pack ./TestStack.BDDfy/*.csproj
--configuration Release
Expand All @@ -199,7 +210,7 @@ jobs:
publish-nuget:
runs-on: ubuntu-latest
needs: build
if: github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch
if: needs.build.outputs.publishNuget == 'true' && (github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch)
environment:
name: Publish
url: https://www.nuget.org/packages/TestStack.BDDfy/
Expand Down
Loading