-
Notifications
You must be signed in to change notification settings - Fork 130
60 lines (53 loc) · 1.82 KB
/
reusable-publish.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
name: 🔒Reusable Workflow Publish
on:
workflow_call:
inputs:
image:
required: true
type: string
description: 'The image to use'
architecture:
required: true
type: string
description: 'The architecture to use'
build_configuration:
required: true
type: string
description: 'The build configuration to use'
secrets:
NUGET_API_KEY:
required: true
NIGHTLY_NUGET_API_KEY:
required: true
NIGHTLY_NUGET_SOURCE:
required: true
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
publish:
name: Publish NuGet Packages from Build Output Cache
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Download Build Cache
uses: ./.github/actions/test-build-cache-download
with:
image: ${{inputs.image}}
architecture: ${{inputs.architecture}}
build_configuration: ${{inputs.build_configuration}}
- name: Push to NuGet
if: ${{github.ref == 'refs/heads/master'}}
run: dotnet nuget push "./artifacts/**/*.nupkg" -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
shell: pwsh
- name: Push to NuGet Nightly
if: ${{github.ref == 'refs/heads/development'}}
run: dotnet nuget push "./artifacts/**/*.nupkg" -k ${{secrets.NIGHTLY_NUGET_API_KEY}} -s ${{secrets.NIGHTLY_NUGET_SOURCE}} --skip-duplicate
shell: pwsh