New version 6 - .NET Standard 2.1 (#63) #238
Workflow file for this run
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: .NET Core | |
# SPDX-FileCopyrightText: Copyright (c) 2009-2020 TRUMPF Laser GmbH, authors: C-Labs | |
# SPDX-License-Identifier: CC0-1.0 | |
on: | |
push: | |
branches: [ main ] | |
tags: [ '[1-9]+.[0-9]+.[0-9]+*' ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: windows-2019 | |
env: | |
cdePackagerCheckOverwrite : true | |
CDE_KVU: ${{secrets.CDE_KVU}} | |
CDE_KVI: ${{secrets.CDE_KVI}} | |
CDE_KVT: ${{secrets.CDE_KVT}} | |
CDE_KVS: ${{secrets.CDE_KVS}} | |
CDE_KVC: ${{secrets.CDE_KVC}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
8.0.x | |
source-url: https://api.nuget.org/v3/index.json | |
config-file: .\nuget.config | |
owner: ${{secrets.NUGETORG_APIKEY_OWNER}} | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.NUGETORG_APIKEY}} | |
# gitversion requires full history and tags | |
- name: Fetch unshallow | |
run: git fetch --prune --tags --unshallow | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.6.6' | |
- name: Use GitVersion | |
id: gitversion # step id used as reference for output values | |
uses: gittools/actions/gitversion/[email protected] | |
env: | |
DOTNET_ROLL_FORWARD: Major | |
- name: Determine pre-release | |
run: | | |
$versionSourceTag = (git tag -l --points-at ${{ steps.gitversion.outputs.versionSourceSha }}) | |
$cdeUsePrereleasePackages = -not ($versionSourceTag -match "^[0-9\.]+$") | |
echo "$versionSourceTag $cdeUsePrereleasePackages" | |
$envUpdate = "cdeUsePrereleasePackages=$cdeUsePrereleasePackages" | |
echo $envUpdate | |
echo $envUpdate | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install AzureSignTool | |
run: dotnet tool install --global AzureSignTool | |
- name: Enable code signing for build | |
run: | | |
try { | |
Set-Content -path ".\BuildTools\\real.sign" -value "" | |
} catch { write-host $_; throw $_ } | |
shell: powershell | |
- name: Install dependencies | |
run: dotnet restore './src/cdePlugins.sln' | |
# Workaround for gitversiontask lock exception: build a single targetframework first | |
#- name: Build PackagerInstaller | |
# run: dotnet build './BuildTools/PackagerInstaller\PackagerInstaller.csproj' --framework net48 --configuration Release --no-restore --disable-parallel | |
- name: Build | |
run: dotnet build './src/cdePlugins.sln' --configuration Release --no-restore --disable-parallel /nowarn:nu5105 | |
- name: Test | |
run: dotnet test './src/cdePlugins.sln' --configuration Release --no-build --no-restore --verbosity normal | |
- name: Gather artifacts | |
run: (robocopy .\bin\ .\artifacts\ *.CDEX *.CDEP *.nupkg *.snupkg *.msi /s /np) ^& IF %ERRORLEVEL% LEQ 1 exit 0 | |
shell: cmd | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: CDEPlugins | |
path: ./artifacts | |
- name: Gather nuget artifacts | |
run: (robocopy .\src\nugets .\artifacts\ *.nupkg *.snupkg /s /np) ^& IF %ERRORLEVEL% LEQ 1 exit 0 | |
shell: cmd | |
- name: REUSE Compliance Check | |
run: | | |
pip3 install --user python-debian==0.1.38 # newer versions fail on Windows as of January 2021 | |
pip3 install --user reuse | |
reuse lint | |
- name: Push NuGet Packages | |
# Only publish if the commit was tagged | |
if: steps.gitversion.outputs.VersionSourceSha == steps.gitversion.outputs.Sha | |
# this should work, but doesn't: | |
#run: dotnet nuget push './artifacts/**/*.nupkg' -s Source -k ${{secrets.GITHUB_TOKEN}} | |
# workaround: | |
run: "Get-ChildItem ./artifacts/*.nupkg -File -Recurse | Foreach { $retryCount=0; do { if ($retryCount -gt 0) {start-sleep 30}; dotnet nuget push $_.fullname -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGETORG_APIKEY}}; $retryCount = $retryCount + 1 } while (($retryCount -lt 10) -and ($LastExitCode -ne 0)); if ($retryCount -ge 10) { throw(\"Error pushing to NuGet: \"+$LastExitCode) } }" |