-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (102 loc) · 3.85 KB
/
Copy pathdotnet.yml
File metadata and controls
121 lines (102 loc) · 3.85 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
name: .NET
on:
push:
branches: [ "main", "master" ]
tags:
- "v*"
pull_request:
branches: [ "main", "master" ]
workflow_dispatch:
inputs:
ref:
description: "Branch or tag to validate/build"
required: true
default: "master"
publish_release:
description: "Also publish a GitHub Release for the selected tag/ref"
required: true
default: "false"
permissions:
contents: write
concurrency:
group: dotnet-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref }}
cancel-in-progress: true
env:
BUILD_CONFIGURATION: Release
jobs:
validate:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build LSPDFRManager.sln --no-restore --configuration $env:BUILD_CONFIGURATION
shell: pwsh
- name: Test
run: dotnet test LSPDFRManager.Tests\LSPDFRManager.Tests.csproj --no-build --configuration $env:BUILD_CONFIGURATION --verbosity normal
shell: pwsh
release:
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_release == 'true')
needs: validate
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore LSPDFRManager.sln
- name: Publish app
run: dotnet publish LSPDFRManager.csproj -c $env:BUILD_CONFIGURATION -r win-x64 --self-contained false -o publish -p:DebugType=None -p:DebugSymbols=false
shell: pwsh
- name: Copy first-impression docs into publish folder
shell: pwsh
run: |
Copy-Item INSTALL.txt publish\INSTALL.txt
Copy-Item LICENSE publish\LICENSE
- name: Verify release payload
shell: pwsh
run: |
$required = @(
'publish\LSPDFRManager.exe',
'publish\LSPDFRManager.dll',
'publish\LSPDFRManager.runtimeconfig.json',
'publish\LSPDFRManager.deps.json',
'publish\SharpCompress.dll',
'publish\ZstdSharp.dll',
'publish\run.bat',
'publish\INSTALL.txt',
'publish\LICENSE'
)
foreach ($path in $required) {
if (-not (Test-Path $path)) {
throw "Missing release file: $path"
}
}
- name: Package release zip
shell: pwsh
run: |
$releaseRoot = "LSPDFRManager-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref_name }}"
if (Test-Path $releaseRoot) {
Remove-Item $releaseRoot -Recurse -Force
}
New-Item -ItemType Directory -Path $releaseRoot | Out-Null
# Copy only the publish output — exclude obj/bin source junk
Copy-Item -Path publish\* -Destination $releaseRoot -Recurse
Compress-Archive -Path $releaseRoot -DestinationPath "$releaseRoot-win-x64.zip"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref_name }}
generate_release_notes: true
files: LSPDFRManager-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref_name }}-win-x64.zip