Skip to content

v1.5.0

v1.5.0 #140

Workflow file for this run

name: CI-CD Pipeline
on:
push:
pull_request:
release:
types:
- published
env:
# Performance optimisations
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Filename shortcuts
PROJECT_NAME: FluentValidationLister.Filter
TESTS_NAME: FluentValidationLister.Tests
# GitHub params
GITHUB_FEED: https://nuget.pkg.github.com/scandal-uk/
GITHUB_USER: scandal-uk
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NuGet params
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_TOKEN: ${{ secrets.NUGET_KEY }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
# Build and run the unit tests
- name: Restore project
run: dotnet restore $PROJECT_NAME/$PROJECT_NAME.csproj
- name: Build project
run: dotnet build $PROJECT_NAME/$PROJECT_NAME.csproj --no-restore --configuration Release
- name: Restore tests
run: dotnet restore $TESTS_NAME/$TESTS_NAME.csproj
- name: Build tests
run: dotnet build $TESTS_NAME/$TESTS_NAME.csproj --no-restore --configuration Release
- name: Run tests
run: dotnet test --no-restore --no-build --configuration Release
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y.%m.%d')"
# Package artifact using the date and rc (release candidate) version suffix
- name: Package project
run: |
VERSION=${{ steps.date.outputs.date }}-rc
dotnet pack -v normal -c Release --include-symbols --include-source --no-build --no-restore -p:PackageVersion=$VERSION $PROJECT_NAME/$PROJECT_NAME.csproj
- name: Upload package/symbols as artifact
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./${{ env.PROJECT_NAME }}/bin/Release/*.*nupkg
prerelease:
# Push the prerelease build to the GitHub feed for anything targeting develop branch
needs: build
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: nupkg
- name: Push build to GitHub feed
run: |
for f in ./nupkg/*.*nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
deploy:
# Push a fresh build to Nuget when a new release version is applied
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
- name: Create build with released version number
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Version Number: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION $PROJECT_NAME/$PROJECT_NAME.csproj
- name: Push build to NuGet feed
run: dotnet nuget push ./${{ env.PROJECT_NAME }}/bin/Release/*.nupkg --source $NUGET_FEED --api-key $NUGET_TOKEN