-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (46 loc) · 2.23 KB
/
nuget_publish.yml
File metadata and controls
51 lines (46 loc) · 2.23 KB
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
name: NuGet Publish
on:
workflow_dispatch:
inputs:
confirmPublish:
description: "Publish WinPath.Library (Y/N)?"
required: true
default: "Y"
publishToNuGetOrGitHubPackages:
description: "Whether to publish to GitHub Packages (GHP) or NuGet (NG)"
required: false
default: "GHP" # GitHub Packages.
jobs:
nuget-publish:
if: github.event.inputs.confirmPublish == 'Y'
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
source-url: https://api.nuget.org/v3/index.json
dotnet-version: "5.0.x"
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Install dependencies
run: cd .\WinPath.Library && dotnet restore
- name: Publish WinPath.Library to GitHub Packages
if: github.event.inputs.publishToNuGetOrGitHubPackages == 'GHP'
shell: pwsh
run: |
cd .\WinPath.Library
dotnet build -c Release
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/ANF-Studios/index.json" -UserName ANF-Studios -Password ${{ secrets.GITHUB_TOKEN }}
$nupkg_files = Get-ChildItem . -Filter *.nupkg -Recurse
foreach ($nupkg_file in $nupkg_files) { nuget push $nupkg_file -Source "GitHub" -SkipDuplicate -NoSymbols }
- name: Publish WinPath.Library to NuGet
if: github.event.inputs.publishToNuGetOrGitHubPackages == 'NG'
shell: pwsh
run: |
cd .\WinPath.Library
dotnet build -c Release
dotnet pack WinPath.Library.csproj -c Release
$nupkg_files = Get-ChildItem . -Filter *.nupkg -Recurse
foreach ($nupkg_file in $nupkg_files) { dotnet nuget push $nupkg_file --skip-duplicate --no-symbols true --api-key ${{ secrets.NUGET_TOKEN }} --source "https://api.nuget.org/v3/index.json" }