Merge pull request #38 from VPKSoft/dependabot/nuget/Scintilla.NET-5.… #54
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 Desktop | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
environment: NuGet | |
strategy: | |
matrix: | |
configuration: [Release] | |
runs-on: windows-latest # For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
env: | |
Solution_Name: VPKSoft.ScintillaLexers.sln | |
App_Project_Directory_1: VPKSoft.ScintillaLexers | |
App_Project_Path_1: VPKSoft.ScintillaLexers\VPKSoft.ScintillaLexers.csproj | |
App_Project_Directory_2: VPKSoft.ScintillaLexers.NET | |
App_Project_Path_2: VPKSoft.ScintillaLexers.NET\VPKSoft.ScintillaLexers.NET.csproj | |
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} | |
NUGETAPI: ${{ secrets.NUGETAPI }} | |
GH_PACKAGES_APIKEY: ${{ secrets.GH_PACKAGES_APIKEY }} | |
PACKAGESAPI: ${{ secrets.PACKAGESAPI }} | |
NUGETCONFIG: ${{ secrets.NUGETCONFIG }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# Install the .NET 6 workload | |
- name: Install .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/[email protected] | |
# Restore the application to populate the obj folder with RuntimeIdentifiers | |
- name: Restore the application | |
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration | |
env: | |
Configuration: ${{ matrix.configuration }} | |
# Create the VPKSoft.ScintillaLexers.NET app package by building and packaging the NuGet | |
- name: Create the VPKSoft.ScintillaLexers.NET NuGet package | |
run: msbuild $env:App_Project_Path_2 /p:Configuration=$env:Configuration | |
- name: Decode nuget.config | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
$nuget_config_bytes = [System.Convert]::FromBase64String("$env:NUGETCONFIG") | |
$currentDirectory = Get-Location | |
$nugetConfigFile = Join-Path -Path $currentDirectory -ChildPath "nuget.config" | |
[IO.File]::WriteAllBytes("$nugetConfigFile", $nuget_config_bytes) | |
- name: NuGet push | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
$currentDirectory = Get-Location | |
$files = Get-ChildItem $currentDirectory -r -Filter *VPKSoft.ScintillaLexers*.nupkg # use the mask to discard possible third party packages.. | |
Write-Output $files.Count | |
for ($i = 0; $i -lt $files.Count; $i++) | |
{ | |
$file = $files[$i].FullName | |
$arguments = @("push", $file, "$env:NUGET_APIKEY", "-Source", "$env:NUGETAPI", "-SkipDuplicate") | |
# sign the NuGet packages. | |
Write-Output (-join("Pushing NuGet:", $file, " ...")) | |
nuget.exe $arguments | |
$arguments = @("push", $file, "$env:GH_PACKAGES_APIKEY", "-Source", "$env:PACKAGESAPI", "-SkipDuplicate") | |
nuget.exe $arguments | |
} |