-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (51 loc) · 2.69 KB
/
nuget.yml
File metadata and controls
66 lines (51 loc) · 2.69 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
name: "Deploy to NuGet on PR Merge"
on:
pull_request:
types: [closed]
workflow_dispatch:
env:
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"
jobs:
merge-PR:
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
runs-on: "ubuntu-latest"
environment: production
permissions:
id-token: write # Enable OIDC for Trusted Publishing
contents: read
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install dotnet"
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
# Build only the library projects (not samples which require MAUI workloads)
- name: "Build SentimentAnalyzer (legacy)"
run: dotnet build SentimentAnalyzer/SentimentAnalyzer.csproj --configuration Release
- name: "Build SentimentAnalyzer.Core"
run: dotnet build SentimentAnalyzer.Core/SentimentAnalyzer.Core.csproj --configuration Release
- name: "Build SentimentAnalyzer.Onnx"
run: dotnet build SentimentAnalyzer.Onnx/SentimentAnalyzer.Onnx.csproj --configuration Release
- name: "Build SentimentAnalyzer.Onnx.Multilingual"
run: dotnet build SentimentAnalyzer.Onnx.Multilingual/SentimentAnalyzer.Onnx.Multilingual.csproj --configuration Release
# Pack all four NuGet packages
- name: "Pack SentimentAnalyzer (legacy)"
run: dotnet pack SentimentAnalyzer/SentimentAnalyzer.csproj --no-build --configuration Release --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: "Pack SentimentAnalyzer.Core"
run: dotnet pack SentimentAnalyzer.Core/SentimentAnalyzer.Core.csproj --no-build --configuration Release --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: "Pack SentimentAnalyzer.Onnx"
run: dotnet pack SentimentAnalyzer.Onnx/SentimentAnalyzer.Onnx.csproj --no-build --configuration Release --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: "Pack SentimentAnalyzer.Onnx.Multilingual"
run: dotnet pack SentimentAnalyzer.Onnx.Multilingual/SentimentAnalyzer.Onnx.Multilingual.csproj --no-build --configuration Release --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: "List packages"
run: ls -la ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
- name: "NuGet login (Trusted Publishing)"
uses: NuGet/login@v1
id: nuget-login
with:
user: arafat
# Push all packages (*.nupkg will match all three)
- name: "Push packages"
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source ${{ env.NUGET_SOURCE_URL }}