Skip to content

Commit

Permalink
Trigger Caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Farshad DASHTI authored and Farshad DASHTI committed Oct 2, 2024
1 parent e18bd4b commit e0a7dd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/nuget-package-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Check for custom version in commit message or check the feed for the latest version and increment it
id: check_custom_version
run: |
PROJECT_NAME=${{ inputs.project_name }} # Add the project name from inputs
PROJECT_NAME=${{ inputs.project_name }} # Get the project name from inputs
# Search the last 10 commits for the version update indicator
COMMIT_HASH=$(git log -n 10 --pretty=format:"%H %s" | grep -P '\(#update package version to \d+\.\d+\.\d+\)' | grep -oP '^\w+' | head -n 1)
Expand All @@ -59,16 +59,16 @@ jobs:
# Extract the version from the commit message
CUSTOM_VERSION=$(git show -s --format=%s $COMMIT_HASH | grep -oP '\(#update package version to \K([0-9]+\.[0-9]+\.[0-9]+)')
if [[ -n "$CUSTOM_VERSION" ]]; then
# Ensure the custom version is only applied if the project name is relevant
if [[ -n "$CUSTOM_VERSION" && "$PROJECT_NAME" == *"$(git show -s --format=%s $COMMIT_HASH | grep -oP 'project: \K\S+')"* ]]; then
echo "Using custom version: $CUSTOM_VERSION"
echo "NEW_VERSION=$CUSTOM_VERSION" >> $GITHUB_ENV
# Tag the commit with the project-specific tag
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
else
echo "Failed to extract version from commit message. Exiting."
exit 1
echo "The custom version commit is not related to this project. Ignoring."
fi
fi
fi
Expand Down
3 changes: 2 additions & 1 deletion src/DfE.CoreLibs.Caching/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using DfE.CoreLibs.Caching.Settings;
using Microsoft.Extensions.Configuration;


namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
Expand All @@ -16,4 +17,4 @@ public static IServiceCollection AddServiceCaching(
return services;
}
}
}
}

0 comments on commit e0a7dd1

Please sign in to comment.