Update dotnet-desktop.yml #331
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 Desktop | |
on: push | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- id: signtool | |
name: Find signtool.exe | |
shell: cmd | |
run: where /f /r "%programfiles(x86)%\windows kits\10\bin" signtool.exe|for /f "delims=" %%s in ('find "\x64\"') do @echo signtool=%%s > %GITHUB_OUTPUT% | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Build and test the application | |
shell: cmd | |
run: | | |
dotnet test --nologo --verbosity minimal --collect:"XPlat Code Coverage" --settings coverlet.runsettings -c Release --results-directory coverage | |
for /r coverage %%f in (coverage.*) do @move %%f lcov.info | |
dir lcov.info | |
- name: Upload coverage report | |
uses: coverallsapp/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN }} | |
path-to-lcov: lcov.info | |
- name: Publish | |
run: | | |
dotnet publish RepopulatorCli/RepopulatorCli.csproj -o RepopulatorCli-win-x64 -c Release -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=false --self-contained true -r win-x64 | |
dotnet publish RepopulatorCli/RepopulatorCli.csproj -o RepopulatorCli-lin-x64 -c Release -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=false --self-contained true -r linux-x64 | |
dotnet publish TemplateBuilder/TemplateBuilder.csproj -o template-builder -c Release -p:PublishReadyToRun=true -p:PublishSingleFile=true --self-contained true -r win-x64 | |
# Decode the base 64 encoded pfx and save the Signing_Certificate | |
- name: Decode the pfx | |
run: '[IO.File]::WriteAllBytes((Join-Path -Path . -ChildPath GitHubActionsWorkflow.pfx), [System.Convert]::FromBase64String("${{ secrets.DIGICERT_PFX }}"))' | |
- name: Sign, delete signing key and compress results | |
shell: cmd | |
run: | | |
${{steps.signtool.outputs.signtool}} Sign /f GitHubActionsWorkflow.pfx /p ${{ secrets.DIGICERT_PASSWORD }} /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 RepopulatorCli-win-x64/RepopulatorCli.exe template-builder/TemplateBuilder.exe | |
del GitHubActionsWorkflow.pfx | |
mkdir -p dist | |
7z a -bd -mx=9 -mmt dist/RepopulatorCli-win-x64.zip RepopulatorCli-win-x64 | |
7z a -bd -mx=9 -mmt dist/RepopulatorCli-lin-x64.zip RepopulatorCli-lin-x64 | |
7z a -bd -mx=9 -mmt dist/template-builder.zip template-builder | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: | | |
dist | |
# Remove the pfx | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
if: contains(github.ref, 'refs/tags/v') | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/*.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |