-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 2.96 KB
/
nuget.yml
File metadata and controls
104 lines (88 loc) · 2.96 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Build Package
on:
push:
branches: [ "main", release-*, develop ]
pull_request:
branches: [ "main", release-*, develop ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Build Solution
run: dotnet build CarpaNet.slnx --configuration Release
- name: Pack Library Projects
run: |
dotnet pack src/CarpaNet/CarpaNet.csproj --configuration Release --no-build --output nupkg
dotnet pack src/CarpaNet.OAuth/CarpaNet.OAuth.csproj --configuration Release --no-build --output nupkg
dotnet pack src/CarpaNet.Jetstream/CarpaNet.Jetstream.csproj --configuration Release --no-build --output nupkg
dotnet pack src/CarpaNet.AspNetCore/CarpaNet.AspNetCore.csproj --configuration Release --no-build --output nupkg
- name: Upload Nuget
uses: actions/upload-artifact@v4
with:
name: nupkg
path: nupkg/*.nupkg
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Run CarpaNet.UnitTests
run: dotnet test tests/CarpaNet.UnitTests/CarpaNet.UnitTests.csproj -- --report-trx --results-directory ../../dotnet-test-results
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: dotnet-test-results
path: dotnet-test-results
if: ${{ always() }}
check-changes:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
outputs:
changed: ${{ steps.changes.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes
id: changes
run: |
if git diff --name-only HEAD~1 HEAD | grep -E "^src/|^tests/|^Directory\.(Build|Packages)\.props$"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
publish:
needs: [build, test, check-changes]
runs-on: ubuntu-latest
if: needs.check-changes.outputs.changed == 'true'
steps:
- name: Download Nuget Package
uses: actions/download-artifact@v4
with:
name: nupkg
path: nupkg
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
- name: Publish to NuGet
run: |
for f in ./nupkg/*.nupkg
do
dotnet nuget push $f --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
done