Skip to content

Commit 1ec6e7a

Browse files
arthurkehrwaldfreezy
authored andcommitted
Install yetanotherhttphandler
1 parent 9bbeb29 commit 1ec6e7a

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,17 @@ jobs:
2525
- uses: actions/checkout@v2
2626
- name: Build
2727
run: |
28-
dotnet build -c Release -r ${{ matrix.rid }}
29-
- run: |
30-
mkdir tmp
31-
cp -r Dependencies/${{ matrix.rid }} tmp/${{ matrix.rid }}
28+
dotnet build -c Release -r ${{ matrix.rid }} -p:InstallYetAnotherHttpHandler=false
3229
- uses: actions/upload-artifact@v4
3330
with:
34-
name: Dependencies-${{ matrix.rid }}
35-
path: tmp/${{ matrix.rid }}
36-
merge:
31+
path: Dependencies/NuGetDependencies/${{ matrix.rid }}
32+
install-yetanotherhttphandler:
3733
runs-on: ubuntu-latest
38-
needs: build
3934
steps:
40-
- name: Merge Artifacts
41-
uses: actions/upload-artifact/merge@v4
42-
with:
43-
name: Dependencies
44-
pattern: Dependencies-*
35+
- run: dotnet build /t:InstallYetAnotherHttpHandler
36+
- uses: actions/upload-artifact@v4
37+
with:
38+
path: Dependencies/YetAnotherHttpHandler
4539

4640
dispatch:
4741
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v2
11-
- uses: dawidd6/action-download-artifact@v4
11+
- uses: actions/download-artifact@v4
1212
with:
13-
workflow: build
14-
run_id: ${{ github.event.client_payload.artifacts_run_id }}
13+
merge-multiple: true
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
run-id: ${{ github.event.client_payload.artifacts_run_id }}
1516
- name: Publish
1617
run: |
1718
echo "//registry.visualpinball.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

VisualPinball.Engine.Mpf.csproj

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,23 @@
1818
<Compile Remove="**/*.cs" />
1919
</ItemGroup>
2020

21+
<!-- Specify runtime identifier-->
2122
<PropertyGroup Condition="'$(RuntimeIdentifier)' == ''">
2223
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(PlatformTarget)' != 'x86'">win-x64</RuntimeIdentifier>
2324
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$(PlatformTarget)' == 'x86'">win-x86</RuntimeIdentifier>
2425
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx</RuntimeIdentifier>
2526
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux-x64</RuntimeIdentifier>
2627
</PropertyGroup>
2728

29+
<PropertyGroup>
30+
<InstallYetAnotherHttpHandler Condition="'$(InstallYetAnotherHttpHandler)' == ''">true</InstallYetAnotherHttpHandler>
31+
</PropertyGroup>
32+
33+
<!-- Specify what version (commit tag) of YetAnotherHttpHandler to install-->
34+
<PropertyGroup Condition="'$(YetAnotherHttpHandlerVersion)' == ''">
35+
<YetAnotherHttpHandlerVersion>1.10.0</YetAnotherHttpHandlerVersion>
36+
</PropertyGroup>
37+
2838
<!-- Specify NuGet dependencies -->
2939
<ItemGroup>
3040
<PackageReference Include="Grpc.Tools" Version="2.69.0 ">
@@ -42,17 +52,32 @@
4252
<Protobuf Include="Runtime/GrpcInterface/*.proto" OutputDir="$(ProjectDir)" GrpcServices="Client" />
4353
</ItemGroup>
4454

45-
<!-- Copy binaries to 'Dependencies' and delete everything else after build-->
46-
<Target Name="CopyDependencies" AfterTargets="AfterBuild">
55+
<!-- Copy NuGet binaries to 'Dependencies/NuGetDependencies'-->
56+
<Target Name="CopyNuGetDependencies" AfterTargets="AfterBuild">
4757
<ItemGroup>
48-
<OutputFiles Include="$(OutDir)\*.*"/>
58+
<OutputFiles Include="$(OutDir)/*.*"/>
4959
</ItemGroup>
60+
<Copy SourceFiles="@(OutputFiles)" DestinationFolder="./Dependencies/NuGetDependencies/$(RuntimeIdentifier)" SkipUnchangedFiles="true"/>
61+
</Target>
62+
63+
<!-- Delete build artifacts-->
64+
<Target Name="DeleteBuildArtifacts" AfterTargets="AfterBuild" DependsOnTargets="CopyNuGetDependencies">
5065
<ItemGroup>
51-
<BuildArtifacts Include=".\obj\"/>
52-
<BuildArtifacts Include=".\bin\"/>
66+
<BuildArtifacts Include="./obj/"/>
67+
<BuildArtifacts Include="./bin/"/>
5368
</ItemGroup>
54-
55-
<Copy SourceFiles="@(OutputFiles)" DestinationFolder=".\Dependencies\$(RuntimeIdentifier)" SkipUnchangedFiles="true"/>
5669
<RemoveDir Directories="@(BuildArtifacts)"/>
5770
</Target>
71+
72+
<!-- Download YetAnotherHttpHandler from GitHub and copy into Dependencies directory-->
73+
<Target Name="InstallYetAnotherHttpHandler" AfterTargets="AfterBuild" Condition="'$(InstallYetAnotherHttpHandler)' == 'true'">
74+
<Exec Command="git clone --no-checkout --depth=1 --filter=tree:0 https://github.com/Cysharp/YetAnotherHttpHandler tmp" ConsoleToMSBuild="true" WorkingDirectory="Dependencies"/>
75+
<Exec Command="git sparse-checkout set --no-cone /src/YetAnotherHttpHandler" ConsoleToMSBuild="true" WorkingDirectory="Dependencies/tmp"/>
76+
<Exec Command="git checkout $(YetAnotherHttpHandlerVersion)" ConsoleToMSBuild="true" WorkingDirectory="Dependencies/tmp"/>
77+
<ItemGroup>
78+
<PackageFiles Include="Dependencies/tmp/src/YetAnotherHttpHandler/**/*.*"/>
79+
</ItemGroup>
80+
<Copy SourceFiles="@(PackageFiles)" DestinationFolder="Dependencies/YetAnotherHttpHandler/%(RecursiveDir)"/>
81+
<RemoveDir Directories="Dependencies/tmp"/>
82+
</Target>
5883
</Project>

0 commit comments

Comments
 (0)