-
Notifications
You must be signed in to change notification settings - Fork 76
59 lines (47 loc) · 1.98 KB
/
nuget.yml
File metadata and controls
59 lines (47 loc) · 1.98 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
name: Publish NuGet Package (Manual)
on:
workflow_dispatch:
inputs:
version:
description: 'Package version (e.g., 0.17.0)'
required: true
type: string
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
VERSION: ${{ inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore src/BlazorWebFormsComponents/BlazorWebFormsComponents.csproj
- name: Build
run: dotnet build src/BlazorWebFormsComponents/BlazorWebFormsComponents.csproj --configuration Release --no-restore -p:Version=${{ env.VERSION }}
- name: Run tests
run: |
dotnet restore src/BlazorWebFormsComponents.Test/BlazorWebFormsComponents.Test.csproj
dotnet test src/BlazorWebFormsComponents.Test/BlazorWebFormsComponents.Test.csproj --configuration Release --verbosity normal
- name: Pack
run: dotnet pack src/BlazorWebFormsComponents/BlazorWebFormsComponents.csproj --configuration Release --no-build --output ./nupkg -p:PackageVersion=${{ env.VERSION }} -p:Version=${{ env.VERSION }}
- name: Push to GitHub Packages
run: dotnet nuget push ./nupkg/*.nupkg --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
- name: Push to nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
if: env.NUGET_API_KEY != ''
run: dotnet nuget push ./nupkg/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ env.NUGET_API_KEY }} --skip-duplicate
- name: Upload NuGet package artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./nupkg/*.nupkg