-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 3 KB
/
Copy pathrelease-nuget.yml
File metadata and controls
85 lines (73 loc) · 3 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
name: Build & Publish NuGet
on:
push:
branches:
- release # run when pushing to the release branch
workflow_dispatch: # optional manual trigger
jobs:
build-pack-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.0.x'
# Read base version from central config file and build full version
- name: Determine version
id: version
run: |
BASE_VERSION=$(cat VERSION.txt)
echo "Base version: $BASE_VERSION"
FULL_VERSION="$BASE_VERSION.${GITHUB_RUN_NUMBER}"
echo "Full version: $FULL_VERSION"
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_OUTPUT
echo "FULL_VERSION=$FULL_VERSION" >> $GITHUB_OUTPUT
# Find solution file dynamically (first .sln we encounter)
- name: Locate solution file
id: solution
run: |
SOLUTION=$(find . -maxdepth 5 -name "*.sln" | head -n 1)
if [ -z "$SOLUTION" ]; then
echo "❌ No solution file (*.sln) found in the repo."
exit 1
fi
echo "Found solution: $SOLUTION"
echo "SOLUTION_PATH=$SOLUTION" >> $GITHUB_OUTPUT
# Restore using the solution
- name: Restore
run: dotnet restore "${{ steps.solution.outputs.SOLUTION_PATH }}"
# Pack all packable projects in the solution into ./artifacts with unified version
- name: Pack all NuGet projects
run: dotnet pack "./FluentAAS/FluentAAS.sln" -c Release -o ./artifacts /p:PackageVersion=${{ steps.version.outputs.FULL_VERSION }}
# Publish NuGet packages to nuget.org
- name: Publish to NuGet
run: dotnet nuget push "./artifacts/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
# Build changelog / release notes automatically using release-changelog-builder
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fetchReleaseInformation: "true"
failOnError: "true"
# Upload artifacts to the workflow run (extra manual download option)
- name: Upload NuGet Artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages-${{ steps.version.outputs.FULL_VERSION }}
path: ./artifacts/*.nupkg
# Create GitHub Release with generated changelog and attach .nupkg files
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.FULL_VERSION }}
name: FluentAAS v${{ steps.version.outputs.FULL_VERSION }}
body: ${{ steps.build_changelog.outputs.changelog }}
files: ./artifacts/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}