This repository was archived by the owner on Feb 24, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
132 lines (115 loc) · 3.65 KB
/
dotnet.yml
File metadata and controls
132 lines (115 loc) · 3.65 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Publish Package to NuGet
on:
push:
branches:
- master
paths:
- 'native/**'
- 'src/VmmSharpEx/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-build:
if: github.repository_owner == 'lone-dma'
runs-on: windows-latest
environment: production
permissions:
id-token: write
steps:
- name: Send Discord Webhook
shell: pwsh
env:
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
REPO: ${{ github.repository }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
$payload = @{
username = "GitHub Actions"
embeds = @(
@{
title = "$env:REPO"
description = "🚀 Build started"
color = 5814783
fields = @(
@{
name = "Commit"
value = $env:COMMIT_MESSAGE
},
@{
name = "Job Link"
value = $env:JOB_URL
}
)
}
)
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Uri $env:WEBHOOK -Method Post -ContentType "application/json" -Body $payload
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
9.0.x
10.0.x
- name: Run Tests
run: |
mkdir -p artifacts
dotnet test src/VmmSharpEx_Tests/VmmSharpEx_Tests.csproj --filter "RunScope=CI" --logger "console;verbosity=detailed" | tee artifacts/test-output.txt
- name: Get version info
uses: dotnet/nbgv@master
id: nbgv
- name: Pack NuGet (Release)
run: |
dotnet pack src/VmmSharpEx/VmmSharpEx.csproj `
-c Release `
-p:ContinuousIntegrationBuild=true `
-p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }} `
-p:AssemblyVersion=${{ steps.nbgv.outputs.AssemblyVersion }} `
-p:FileVersion=${{ steps.nbgv.outputs.AssemblyFileVersion }} `
-o artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: artifacts/*
publish:
runs-on: windows-latest
environment: production
needs: test-build
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: build
path: artifacts
- name: Get version info
uses: dotnet/nbgv@master
id: nbgv
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.nbgv.outputs.SemVer2 }}" `
--title "VmmSharpEx ${{ steps.nbgv.outputs.SemVer2 }}" `
--notes "Available at https://www.nuget.org/packages/VmmSharpEx" `
artifacts/test-output.txt
- name: NuGet Login
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: NuGet Push
run: dotnet nuget push "artifacts/**/*.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json