Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 19 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,65 +27,29 @@ jobs:
uses: Goobwabber/[email protected]
with:
manifest: ${{ github.workspace }}/BeatSaberSDK/manifest.json
- name: Generate BeatSaberDir override (.csproj.user)
shell: pwsh
run: |
# Path to the project file (adjust if the name or folder changes)
$projPath = "$Env:GITHUB_WORKSPACE\BeatSaberSDK\BeatSaberSDK.csproj"
$userFile = "$projPath.user"

# Compute the absolute path to Refs
$refsPath = [IO.Path]::GetFullPath((Join-Path $Env:GITHUB_WORKSPACE 'Refs'))

@"
<Project>
<PropertyGroup>
<BeatSaberDir>$refsPath</BeatSaberDir>
</PropertyGroup>
</Project>
"@ | Out-File -FilePath $userFile -Encoding utf8 -Force

Write-Host "Created $userFile with BeatSaberDir = $refsPath"
- name: Build
id: Build
run: dotnet build --configuration Release
- name: GitStatus
run: git status
- name: Package output as zip (Libs\ & Plugins\)
id: package
shell: pwsh
run: |
$buildDir = "$Env:GITHUB_WORKSPACE\BeatSaberSDK\bin\Release\net48"
$packageDir = "$Env:GITHUB_WORKSPACE\package"
$libsDir = Join-Path $packageDir 'Libs'
$pluginsDir = Join-Path $packageDir 'Plugins'

New-Item $libsDir -ItemType Directory -Force | Out-Null
New-Item $pluginsDir -ItemType Directory -Force | Out-Null

Copy-Item "$buildDir\Reactive.Components.dll" $libsDir
Copy-Item "$buildDir\Reactive.dll" $libsDir
Copy-Item "$buildDir\Reactive.BeatSaber.Components.dll" $pluginsDir
Copy-Item "$buildDir\Reactive.BeatSaber.Components.pdb" $pluginsDir
Copy-Item "$buildDir\Reactive.Components.pdb" $pluginsDir
Copy-Item "$buildDir\Reactive.pdb" $pluginsDir

$zipPath = "$Env:GITHUB_WORKSPACE\beat-saber-sdk.zip"
Compress-Archive -Path "$packageDir\*" -DestinationPath $zipPath -Force

"zipfile=$zipPath" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
"packagedir=$packageDir" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
env:
BeatSaberDir: ${{ github.workspace }}/Refs/

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: beat-saber-sdk
path: ${{ steps.package.outputs.packagedir }}

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ steps.package.outputs.zipfile }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
name: ${{ steps.Build.outputs.filename }}
path: ${{ steps.Build.outputs.artifactpath }}

# Temporarily disable creating releases until we have a proper way to include yoga.dll
# - name: Zip Artifact for Release
# run: Compress-Archive -Path "${{ steps.Build.outputs.artifactpath }}\*" -DestinationPath "./${{ steps.Build.outputs.filename }}.zip"
# if: startsWith(github.ref, 'refs/tags/')
#
# - name: Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# draft: true
# generate_release_notes: true
# files: ./${{ steps.Build.outputs.filename }}.zip
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
25 changes: 4 additions & 21 deletions BeatSaberSDK/BeatSaberSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net48</TargetFramework>
<OutputType>Library</OutputType>
<LocalRefsDir Condition="Exists('..\Refs')">..\Refs</LocalRefsDir>
<BeatSaberDir>$(LocalRefsDir)</BeatSaberDir>
<BeatSaberDir Condition="'$(BeatSaberDir)' == ''">$(LocalRefsDir)</BeatSaberDir>
<AppOutputBase>$(MSBuildProjectDirectory)\</AppOutputBase>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
Expand All @@ -19,6 +19,9 @@
</PropertyGroup>

<Import Project="$(MSBuildProjectFile).user" Condition="Exists('$(MSBuildProjectFile).user')"/>
<ItemGroup>
<None Include="$(MSBuildProjectFile).user" Condition="Exists('$(MSBuildProjectFile).user')"/>
</ItemGroup>
<PropertyGroup>
<UnityAssembliesDir Condition="'$(UnityAssembliesDir)' == ''">$(BeatSaberDir)\Beat Saber_Data\Managed</UnityAssembliesDir>
</PropertyGroup>
Expand Down Expand Up @@ -82,26 +85,6 @@
<EmbeddedResource Include="manifest.json"/>
</ItemGroup>

<!-- Post-processing -->
<PropertyGroup>
<ArtifactsDest>$(BeatSaberDir)\Plugins</ArtifactsDest>
<LibArtifactsDest>$(BeatSaberDir)\Libs</LibArtifactsDest>
<ArtifactFile>bin\$(Configuration)\net48\Reactive</ArtifactFile>
</PropertyGroup>

<ItemGroup>
<Artifacts Include="$(ArtifactFile).BeatSaber.Components.dll;$(ArtifactFile).BeatSaber.Components.pdb"/>
<LibArtifacts Include="$(ArtifactFile).Components.dll;$(ArtifactFile).Components.pdb;$(ArtifactFile).dll;$(ArtifactFile).pdb"/>
</ItemGroup>

<Target Condition="$(CopyArtifacts) == True" Name="CopyArtifacts" AfterTargets="Build">
<Message Importance="high" Text="Copying artifacts:
BeatSaberSDK to $(ArtifactsDest)
Libs to $(LibArtifactsDest)"/>
<Copy SourceFiles="@(Artifacts)" DestinationFolder="$(ArtifactsDest)"/>
<Copy SourceFiles="@(LibArtifacts)" DestinationFolder="$(LibArtifactsDest)"/>
</Target>

<ItemGroup>
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.2">
<PrivateAssets>all</PrivateAssets>
Expand Down
17 changes: 17 additions & 0 deletions BeatSaberSDK/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file contains project properties used by the build. -->
<Project>
<PropertyGroup>
<BSMTProjectType>BSIPA</BSMTProjectType>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>

<ItemGroup>
<OutputCopy Include="$(OutputPath)\Reactive.dll" OutputPath="Libs\Reactive.dll" />
<OutputCopy Include="$(OutputPath)\Reactive.pdb" OutputPath="Libs\Reactive.pdb" />
<OutputCopy Include="$(OutputPath)\Reactive.Components.dll" OutputPath="Libs\Reactive.Components.dll" />
<OutputCopy Include="$(OutputPath)\Reactive.Components.pdb" OutputPath="Libs\Reactive.Components.pdb" />
<OutputCopy Include="$(OutputPath)\$(TargetFileName)" OutputPath="Plugins\$(TargetFileName)" />
<OutputCopy Include="$(OutputPath)\$(TargetName).pdb" OutputPath="Plugins\$(TargetName).pdb" />
</ItemGroup>
</Project>
Loading