-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (52 loc) · 1.89 KB
/
Copy pathpublish.yml
File metadata and controls
62 lines (52 loc) · 1.89 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
name: Publish to NuGet
# Triggers when you push a version tag, e.g.: git tag v2.0.1 && git push --tags
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
name: Pack & publish
runs-on: windows-latest # System.Drawing.Common requires Windows on .NET 8/9
permissions:
contents: write # needed to create a GitHub Release
defaults:
run:
shell: bash # use bash on all steps so glob expansion works
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
# Strip the leading 'v' from the tag to get the bare version number
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
# Single atomic step: restore + build + pack in one MSBuild invocation.
# Splitting restore and pack --no-restore causes net9.0-windows to be
# silently dropped from the nupkg when conditional ItemGroups are used.
# Use -p: (not /p:) — Git Bash on Windows strips leading / from MSBuild flags.
- name: Pack
run: |
dotnet pack src/ImageProcessor.Core/ImageProcessor.Core.csproj \
-c Release \
-p:Version=${{ steps.version.outputs.VERSION }} \
-o artifacts
- name: List artifacts (debug)
run: ls -la artifacts/
- name: Push to NuGet.org
run: |
dotnet nuget push artifacts/*.nupkg \
--api-key "${{ secrets.NUGET_API_KEY }}" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
files: artifacts/*.nupkg
generate_release_notes: true