Skip to content

GUARD-2994 Automate NuGet package pushing #2

GUARD-2994 Automate NuGet package pushing

GUARD-2994 Automate NuGet package pushing #2

Workflow file for this run

name: Continuous Integration/Continous Deployment
# Runs when a pull request (against master branch) is opened, reopened or when the master branch is updated or when a release tag is created.
on:
pull_request:
branches:
- master
create:
branches:
- release/**
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION_NAME: '.\src\ThreeDCartAccess.sln'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK 6.x
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.x
- name: Setup DotCover
run: dotnet tool install JetBrains.dotCover.GlobalTool -g
- name: Install dependencies
run: dotnet restore $SOLUTION_NAME
- name: Get build version
run: |
Import-Module .\build\GetBuildVersion.psm1
Write-Host $Env:GITHUB_REF
$version = GetBuildVersion -VersionString $Env:GITHUB_REF
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh
- name: Build
run: dotnet build $SOLUTION_NAME --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore
- name: Unit tests
run: dotnet dotcover test --no-restore --verbosity normal --dcReportType=HTML --dcOutput="test-results/ThreeDCartAccessTests.html" ".\src\ThreeDCartAccessTests\ThreeDCartAccessTests.csproj"
- name: Archive code coverage report
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: test-results
- name: Authenticate with Github package repo
if: startsWith(github.ref, 'refs/tags')
run: dotnet nuget add source --username SkuVault --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/skuvault-integrations/index.json"
- name: Publish to package repository
if: startsWith(github.ref, 'refs/tags')
run: dotnet nuget push **\*.$BUILD_VERSION.nupkg --source "github"