Skip to content

Commit d782b29

Browse files
committed
Fix gha nuget publish and add gha build only for commits to master.
1 parent 0adb6c8 commit d782b29

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

.github/workflows/nuget.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,41 @@
1-
name: Publish to Nuget
1+
name: Publish to NuGet
22

33
on:
44
push:
55
tags:
6-
- 'v*' # Triggers on tag pushes starting with 'v'
6+
- 'v*' # Triggers only on tags starting with "v"
77

88
jobs:
99
build-and-publish:
10+
runs-on: windows-latest # ← must run on Windows for net*-windows projects
1011
strategy:
1112
matrix:
12-
framework: ['net8.0']
13-
runs-on: ubuntu-latest
13+
framework: ['net8.0-windows10.0.17763.0']
14+
1415
steps:
15-
# Checkout the repository
16-
- uses: actions/checkout@v2
16+
- name: Checkout code
17+
uses: actions/checkout@v3
1718

18-
# Set up .NET SDK
19-
- uses: actions/setup-dotnet@v2
19+
- name: Setup .NET SDK
20+
uses: actions/setup-dotnet@v3
2021
with:
2122
dotnet-version: '8.0.x'
2223

23-
# Restore dependencies
2424
- name: Restore dependencies
2525
run: dotnet restore src/SIPSorceryMedia.Windows.csproj
2626

27-
# Build the project
2827
- name: Build
2928
run: dotnet build src/SIPSorceryMedia.Windows.csproj -c Release --no-restore
3029

31-
# Pack the NuGet package
3230
- name: Pack NuGet package
33-
run: dotnet pack src/SIPSorceryMedia.Windows.csproj -c Release -o ./artifacts
31+
run: dotnet pack src/SIPSorceryMedia.Windows.csproj -c Release -o ./artifacts --no-build
3432

35-
# Publish to NuGet
36-
- name: Publish NuGet package
37-
if: startsWith(github.ref, 'refs/tags/v') # Only run on tag pushes
33+
- name: Publish to NuGet.org
34+
if: startsWith(github.ref, 'refs/tags/v')
3835
env:
3936
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
4037
run: |
4138
dotnet nuget push ./artifacts/*.nupkg \
4239
--source https://api.nuget.org/v3/index.json \
4340
--api-key $NUGET_API_KEY
41+

.github/workflows/windows-dev.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run on master commits
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: windows-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Setup .NET SDK
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: '8.0.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore src/SIPSorceryMedia.Windows.csproj
23+
24+
- name: Build
25+
run: dotnet build src/SIPSorceryMedia.Windows.csproj -c Release --no-restore

0 commit comments

Comments
 (0)