-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (66 loc) · 2.44 KB
/
Copy pathrelease.yml
File metadata and controls
82 lines (66 loc) · 2.44 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
name: Build DLL and publish ZIP release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Validate SimHub reference DLLs exist
shell: pwsh
run: |
$deps = @(
"lib/simhub/SimHub.Plugins.dll",
"lib/simhub/SimHub.Logging.dll",
"lib/simhub/GameReaderCommon.dll",
"lib/simhub/WoteverCommon.dll",
"lib/simhub/WoteverLocalization.dll"
)
$missing = @()
foreach ($d in $deps) {
if (-not (Test-Path $d)) { $missing += $d }
}
if ($missing.Count -gt 0) {
throw "Fehlende Build-Abhängigkeiten (SimHub DLLs). Lege sie ins Repo unter 'lib/simhub': `n- " + ($missing -join "`n- ")
}
- name: Build (Release)
shell: pwsh
run: |
# Ensure MSBuild can resolve SimHub references via ReferencePath
$refPath = (Resolve-Path "lib/simhub").Path
msbuild ".\LMU REST API.sln" /m /p:Configuration=Release /p:ReferencePath="$refPath"
- name: Prepare dist folder (DLL only)
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist | Out-Null
$dllPath = ".\LMU REST API\bin\Release\LMUEnergyPlugin.dll"
if (!(Test-Path $dllPath)) {
throw "DLL nicht gefunden unter: $dllPath. Prüfe OutputPath/AssemblyName oder ob Build fehlgeschlagen ist."
}
Copy-Item $dllPath -Destination ".\dist\" -Force
- name: Create ZIP
shell: pwsh
run: |
$tag = "${{ github.ref_name }}" # e.g. v0.0.0.1
$zipName = "LMU_RESTAPI_$tag.zip" # => LMU_RESTAPI_v0.0.0.1.zip
if (Test-Path $zipName) { Remove-Item $zipName -Force }
Compress-Archive -Path ".\dist\LMUEnergyPlugin.dll" -DestinationPath $zipName
"ZIP_NAME=$zipName" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Create GitHub Release and upload ZIP
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
files: |
${{ env.ZIP_NAME }}