Skip to content

v5 Release of Polly wrapper #105

v5 Release of Polly wrapper

v5 Release of Polly wrapper #105

name: CI
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
build:
runs-on: windows-latest
environment: dev
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Check for Tag on Current Commit
run: |
# Fetch all tags from the remote repository
git fetch https://github.com/Evidos/SignhostClientLibrary.Polly.git --tags
# Check if the current commit has a tag
CURRENT_TAG=$(git tag --points-at HEAD | head -n 1)
if [ -z "$CURRENT_TAG" ]; then
echo "No tag found on current commit. Skipping release steps."
echo "HAS_TAG=false" >> $GITHUB_ENV
else
echo "Tag found on current commit: $CURRENT_TAG"
# If the tag contains a "v", remove it to get the version (if needed)
VERSION=${CURRENT_TAG#v}
echo "HAS_TAG=true" >> $GITHUB_ENV
echo "LATEST_VERSION=${VERSION}" >> $GITHUB_ENV
echo "Version ${VERSION}"
fi
shell: bash
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
- name: Clear NuGet Cache
run: dotnet nuget locals all --clear
- name: Restore NuGet packages
run: dotnet restore "src/SignhostAPIRetryClient.sln"
continue-on-error: ${{ github.event.pull_request.head.repo.fork == true }}
if: ${{ github.event.pull_request.head.repo.fork == false }}
- name: Build solution
run: dotnet build "src/SignhostAPIRetryClient.sln" --configuration Release
- name: Test with Coverage
run: dotnet test --no-build src/Signhost.APIClient.Tests/Signhost.APIClient.Tests.csproj --collect:"XPlat Code Coverage" -c Release
- name: Pack NuGet package
run: dotnet pack "src/Signhost.APIClient/Signhost.APIClient.csproj" --configuration Release /p:Version=${{ env.LATEST_VERSION }} /p:IncludeReadmeFile=true
if: env.HAS_TAG == 'true' && github.ref == 'refs/heads/master'
- name: Upload NuGet Package
uses: actions/upload-artifact@v6
with:
name: Nuget
path: '**/*.nupkg'
if: env.HAS_TAG == 'true' && github.ref == 'refs/heads/master'
- name: Publish NuGet package to NuGet.org
run: |
dotnet nuget push '**/*.nupkg' --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
env:
POLLY_TEST: ${{ secrets.NUGET_KEY }}
if: env.HAS_TAG == 'true' && github.ref == 'refs/heads/master'