This repository has been archived by the owner on Aug 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 2.62 KB
/
dotnet-nuget_windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET NuGet Windows Release
on:
release:
types: created
workflow_dispatch:
jobs:
build:
environment: NuGet
runs-on: windows-latest
env:
Solution_Name: Windows\Scintilla.NET.EtoForms.Windows.Nugets.sln
App_Project_Path1: Windows\Scintilla.NET.EtoForms.WinForms\Scintilla.NET.EtoForms.WinForms.csproj
App_Project_Path2: Windows\Scintilla.NET.EtoForms.Wpf\Scintilla.NET.EtoForms.Wpf.csproj
App_Project_Path3: Scintilla.NET.Eto.Windows\Scintilla.NET.Eto.Windows.csproj
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
NUGETAPI: ${{ secrets.NUGETAPI }}
GH_PACKAGES_APIKEY: ${{ secrets.GH_PACKAGES_APIKEY }}
PACKAGESAPI: ${{ secrets.PACKAGESAPI }}
NUGETCONFIG: ${{ secrets.NUGETCONFIG }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore $Env:Solution_Name
- name: Build WinForms
run: dotnet build --no-restore --configuration Release $Env:App_Project_Path1
- name: Build Wpf
run: dotnet build --no-restore --configuration Release $Env:App_Project_Path2
- name: Build Windows (Wpf & WinForms)
run: dotnet build --no-restore --configuration Release $Env:App_Project_Path3
- 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
run: |
$currentDirectory = Get-Location
$files = Get-ChildItem $currentDirectory -r -Filter *Scintilla.NET.Eto*.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
}