-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.71 KB
/
publish.yml
File metadata and controls
55 lines (48 loc) · 1.71 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
name: Publish
on:
workflow_dispatch:
inputs:
version:
description: 'Optional package version override (defaults to project version)'
required: false
type: string
jobs:
publish:
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore DotNetPythonEmbed.sln
- name: Build
run: dotnet build DotNetPythonEmbed.sln --configuration Release --no-restore
- name: Pack
run: |
VERSION_INPUT="${{ github.event.inputs.version }}"
if [ -n "$VERSION_INPUT" ]; then
dotnet pack src/DotNetPythonEmbed/DotNetPythonEmbed.csproj --configuration Release --no-build --output ./artifacts /p:PackageVersion=$VERSION_INPUT
else
dotnet pack src/DotNetPythonEmbed/DotNetPythonEmbed.csproj --configuration Release --no-build --output ./artifacts
fi
- name: Publish to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo 'NUGET_API_KEY secret is not configured' >&2
exit 1
fi
PACKAGE_PATH=$(find ./artifacts -maxdepth 1 -name 'DotNetPythonEmbed*.nupkg' | sort | tail -n 1)
if [ -z "$PACKAGE_PATH" ]; then
echo 'No package found to publish' >&2
exit 1
fi
dotnet nuget push "$PACKAGE_PATH" \
--source https://api.nuget.org/v3/index.json \
--api-key "$NUGET_API_KEY" \
--skip-duplicate