Skip to content

Уменьшены аллокации, добавлены тесты, в.2.0.1 #8

Уменьшены аллокации, добавлены тесты, в.2.0.1

Уменьшены аллокации, добавлены тесты, в.2.0.1 #8

name: 'Build, test and publish packages'
on:
push:
tags:
- v*.*
pull_request:
tags:
- v*.*
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Set the build number in MinVer.
MINVERBUILDMETADATA: build.${{github.run_number}}
jobs:
build:
name: Build-${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: 'Checkout'
uses: actions/checkout@v2
- name: 'Setup .NET Core'
uses: actions/[email protected]
with:
dotnet-version: '6.0.x'
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: 'Install dependencies'
run: dotnet restore
- name: 'Build'
run: dotnet build --configuration Release --no-restore
- name: 'Test'
run: dotnet test --no-restore --verbosity normal
- name: 'Pack'
run: dotnet pack --no-build --configuration Release src/Delobytes.NetCore.EntityReportGeneration.csproj --output distr
- name: 'Upload package'
uses: actions/[email protected]
with:
name: ${{matrix.os}}
path: "distr"
if-no-files-found: error
retention-days: 1
check-tag:
name: 'Check tag'
runs-on: ubuntu-latest
outputs:
tagName: ${{ steps.tagName.outputs.tag }}
steps:
- name: 'Get tag'
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: 'Fail if no tag'
if: ${{ steps.tag.outputs.tag == '' }}
run: exit 1
push-github-package:
name: 'Push GitHub Package'
needs: [build, check-tag]
if: success()
runs-on: ubuntu-latest
steps:
- name: 'Download Artefact'
uses: actions/[email protected]
with:
name: 'ubuntu-latest'
- name: 'Dotnet NuGet Push'
run: |
dotnet nuget push *.nupkg --source https://nuget.pkg.github.com/Delobytes.NetCore.EntityReportGeneration/index.json --skip-duplicate --api-key ${{ github.token }}
push-nuget-package:
name: 'Push NuGet Package'
needs: [build, check-tag]
runs-on: ubuntu-latest
steps:
- name: 'Download Artefact'
uses: actions/[email protected]
with:
name: 'ubuntu-latest'
- name: 'Dotnet NuGet Push'
run: |
dotnet nuget push *.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}