Pipeline #399
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pipeline | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- '**.md' | |
schedule: | |
- cron: "0 1 * * *" | |
release: | |
types: [published] | |
workflow_dispatch: # manually run | |
inputs: | |
reason: | |
description: 'Reason for triggering' | |
required: true | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
NUGET_FEED: https://api.nuget.org/v3/index.json | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set version | |
id: versioner | |
run: | | |
if [[ ${{ github.event_name }} == 'release' ]]; then | |
version="${{ github.ref }}" | |
version="${version##*/}" | |
version="${version/[^0-9.]/}" | |
else | |
version="0.0.${{ github.run_number }}" | |
# Add your commands for non-release events (command B) | |
fi | |
echo "${{ github.event_name }} ${{ github.ref }} generated version $version" | |
echo "Version=${version}" >> $GITHUB_OUTPUT | |
- name: Setup .NET core 3.1.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '3.1.x' | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: dotnet restore --verbosity m | |
- name: Build | |
run: dotnet build --no-restore --verbosity m --configuration Release /p:Version=${{ steps.versioner.outputs.Version }} | |
- name: Test | |
run: dotnet test --no-build --configuration Release --verbosity quiet --logger "trx" --results-directory "TestResults" | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: Tests Reports | |
path: TestResults/* | |
reporter: dotnet-trx | |
- name: Copy generated nuget file | |
run: find . -name "SystemTestingTools*.nupkg" -exec cp "{}" ./ \; | |
- name: Set nuget package artifact | |
if: ${{ success() }} # run this step even if previous steps failed | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NugetPackage | |
path: SystemTestingTools*.nupkg | |
retention-days: 7 | |
if-no-files-found: error | |
deploy: | |
needs: build | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: NugetPackage | |
- name: Push to NuGet Feed | |
run: dotnet nuget push ./*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY |