-
Notifications
You must be signed in to change notification settings - Fork 14
83 lines (66 loc) · 2.27 KB
/
build.yml
File metadata and controls
83 lines (66 loc) · 2.27 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
name: Build and Publish
on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
DOTNET_VERSION: '8.0.x'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install MSMQ
run: |
Write-Host "Installing MSMQ feature..."
Enable-WindowsOptionalFeature -Online -FeatureName MSMQ-Server -All -NoRestart
Write-Host "MSMQ installation completed."
Write-Host "Starting MSMQ service..."
Start-Service -Name MSMQ
Get-Service -Name MSMQ
Write-Host "Creating test queue..."
[System.Reflection.Assembly]::LoadWithPartialName("System.Messaging") | Out-Null
$queuePath = ".\Private$\myQueue"
if (-not [System.Messaging.MessageQueue]::Exists($queuePath)) {
[System.Messaging.MessageQueue]::Create($queuePath)
Write-Host "Queue created: $queuePath"
} else {
Write-Host "Queue already exists: $queuePath"
}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./artifacts/*.nupkg
publish:
runs-on: windows-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget-package
path: ./artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- 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