Skip to content

Commit 2c80fb3

Browse files
authored
Add dmxc Builder script
1 parent 4b4811f commit 2c80fb3

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.github/workflows/dmxc.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
2+
name: Build DMXControl Plugin
3+
4+
env:
5+
PluginName: "Nanoleaf-Plugin"
6+
SolutionName: "Nanoleaf-Plugin"
7+
8+
on: push
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4.2.2
16+
17+
- name: Setup MSBuild
18+
uses: microsoft/setup-msbuild@v1.1
19+
20+
- name: Setup Nuget
21+
uses: nuget/setup-nuget@v1
22+
23+
- name: Navigate to Workspace
24+
run: cd $GITHUB_WORKSPACE
25+
26+
- name: Download and extract DMXCDependencies
27+
run: |
28+
foreach ($folder in (Get-ChildItem -Filter dmxcplug.json -Recurse -Depth 1).DirectoryName) {
29+
$dmxcplugver = (Get-Content "${folder}/dmxcplug.json" | ConvertFrom-Json).version
30+
$dmxctypes = (Get-Content "${folder}/dmxcplug.json" | ConvertFrom-Json).type
31+
$dmxczip = "deps-${dmxcplugver}.zip"
32+
If(-Not (Test-Path -Path "${dmxczip}")) {
33+
Invoke-RestMethod -Uri "https://www.dmxcontrol.de/files/DMXControl_3/plugin-lib/dmxc-plugin-lib-${dmxcplugver}.zip" -OutFile "${dmxczip}"
34+
}
35+
Expand-Archive "${dmxczip}" "${folder}/temp"
36+
New-Item -ItemType Directory -Force -Path "${folder}/bin/Release"
37+
foreach ($type in $dmxctypes){
38+
Copy-Item -Path "${folder}/temp/${type}/*" -Destination "${folder}/bin/Release"
39+
}
40+
}
41+
42+
- name: Restore nuget packages
43+
run: |
44+
msbuild.exe ${{env.SolutionName}}.sln /t:restore
45+
nuget restore ${{env.SolutionName}}.sln
46+
47+
- name: Build Solution
48+
run: |
49+
msbuild.exe ${{env.SolutionName}}.sln /p:platform="Any CPU" /p:configuration="Release" /p:PostBuildEvent=
50+
51+
- name: Copy Artifacts
52+
run: |
53+
foreach ($folder in (Get-ChildItem -Filter dmxcplug.json -Recurse -Depth 1).DirectoryName) {
54+
foreach($type in (Get-Content "${folder}/dmxcplug.json" | ConvertFrom-Json).type) {
55+
$filter = Get-ChildItem "${folder}/temp/${type}" -Name
56+
New-Item -ItemType "directory" -Path "dist/${type}/${{env.PluginName}}"
57+
Get-ChildItem "${folder}/bin/Release" -Name | where {$filter -NotContains $_} | %{ Copy-Item -Path "${folder}/bin/Release/${_}" -Destination "dist/${type}/${{env.PluginName}}/${_}"}
58+
}
59+
}
60+
61+
- name: Upload artifact
62+
uses: actions/upload-artifact@v4.6.2
63+
with:
64+
name: DllBundle
65+
path: "dist"
66+
67+
- name: Create Releasezip
68+
run: |
69+
Compress-Archive -Path dist/* -DestinationPath ${{env.PluginName}}.zip
70+
"${{env.PluginName}}.zip: `$SHA256`$$((Get-FileHash ${{env.PluginName}}.zip -Algorithm SHA256).Hash)" > checksums
71+
72+
- name: Release
73+
uses: softprops/action-gh-release@v1
74+
if: startsWith(github.ref, 'refs/tags/')
75+
with:
76+
files: |
77+
${{env.PluginName}}.zip
78+
checksums

0 commit comments

Comments
 (0)