-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (99 loc) · 3.56 KB
/
Copy pathdeploy-nuget.yml
File metadata and controls
118 lines (99 loc) · 3.56 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: publish
on:
workflow_dispatch:
pull_request:
branches:
- '*'
workflow_call:
inputs:
deploy:
required: false
default: false
description: "Deploy the package to NuGet"
type: boolean
version:
required: true
type: string
description: "Semantic version number for the NuGet package"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace }}/nuget
jobs:
create_nuget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Build project
run: dotnet build src/LokiCat.GodotNodeInterfaces.Observables.ObservableGenerator/LokiCat.GodotNodeInterfaces.Observables.ObservableGenerator.csproj --configuration Release -p:Determinstic=true -p:ContinuousIntegrationBuild=true -p:PathMap=$(pwd)=.
- name: Pack project
run: dotnet pack src/LokiCat.GodotNodeInterfaces.Observables.ObservableGenerator/LokiCat.GodotNodeInterfaces.Observables.ObservableGenerator.csproj --no-build --configuration Release --output "$NuGetDirectory" /p:Version=${{ inputs.version }}
- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NuGetDirectory }}/*
validate_nuget:
runs-on: ubuntu-latest
needs: [create_nuget]
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Download NuGet package
uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Install NuGet validator
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
- name: Validate package
run: |
for file in "$NuGetDirectory"/*.nupkg; do
meziantou.validate-nuget-package "$file"
done
run_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Run tests
run: dotnet test ${{ vars.SOURCE_ROOT }} --configuration Release
deploy:
if: ${{ inputs.deploy }}
runs-on: ubuntu-latest
needs: [validate_nuget, run_test]
steps:
- name: Download NuGet package
uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Upload NuGet assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
files: |
${{ env.NuGetDirectory }}/*.nupkg
${{ env.NuGetDirectory }}/*.snupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish NuGet package
run: |
find "$NuGetDirectory" -name '*.nupkg' | while read -r file; do
dotnet nuget push "$file" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done
- name: Publish NuGet symbol package
run: |
find "$NuGetDirectory" -name '*.snupkg' | while read -r file; do
dotnet nuget push "$file" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done