-
-
Notifications
You must be signed in to change notification settings - Fork 10
58 lines (51 loc) · 2.05 KB
/
_deploy-nuget.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
name: 🚀 Deploy to NuGet
run-name: Deploy ${{ inputs.project-name }} NuGet package
on:
workflow_call:
inputs:
environment:
description: 'The build environment'
default: development
type: string
owner:
description: 'GitHub repository owner name'
default: danzuep
type: string
project-name:
description: 'The name of the project'
required: true
type: string
version:
description: 'Package version suffix'
required: true
type: string
jobs:
deploy:
name: 🚀 ${{ inputs.project-name }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
environment: ${{ inputs.environment }}
env:
PACKAGE_NAMES: '${{ inputs.project-name }}.*.nupkg'
steps:
# https://github.com/actions/download-artifact/blob/main/docs/MIGRATION.md
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: ${{ inputs.project-name }}
path: .
merge-multiple: true
- name: Get .NET externals
uses: actions/setup-dotnet@v4
- name: List files in the folder
run: find . -name "*.nupkg" -type f -exec echo {} \;
# run: Get-ChildItem -Path "./.nupkg" | Where-Object {$_.PSIsContainer -eq $false} | SELECT Name
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry#authenticating-with-github_token-in-github-actions
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action
- name: Publish to NuGet
run: |
dotnet nuget push $PACKAGE_NAMES --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Markdown workflow job summary
run: echo "### ${{ inputs.project-name }}.*.${{ inputs.version }}.nupkg packages published" >> $GITHUB_STEP_SUMMARY