Skip to content
Merged
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
28 changes: 26 additions & 2 deletions .github/workflows/build-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ permissions:
contents: read

jobs:
setup-game-dlls:
uses: ./.github/workflows/setup-game-dlls.yml
secrets:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}

Comment thread
Brollyy marked this conversation as resolved.
build-on-pr:
needs: setup-game-dlls
runs-on: ubuntu-latest

steps:
Expand All @@ -21,8 +28,25 @@ jobs:
with:
dotnet-version: 9.0.x

- name: Download game DLLs artifact
uses: actions/download-artifact@v4
with:
name: game-dlls
path: ~/bits-and-bops/Bits & Bops_Data/Managed

- name: Create BopVisualEffects.user.props
run: |
mkdir -p BopVisualEffects
cat > BopVisualEffects/BopVisualEffects.user.props << EOF
<Project>
<PropertyGroup>
<GameRoot>$HOME/bits-and-bops</GameRoot>
</PropertyGroup>
</Project>
EOF

- name: Restore
run: dotnet restore BopVisualEffects.sln -p:SkipGameReferences=true
run: dotnet restore BopVisualEffects.sln

- name: Build
run: dotnet build BopVisualEffects.sln -c Release -p:SkipGameReferences=true --no-restore
run: dotnet build BopVisualEffects.sln -c Release --no-restore
29 changes: 28 additions & 1 deletion .github/workflows/format-and-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ on:
branches: ["master"]
merge_group:

permissions:
contents: read

jobs:
setup-game-dlls:
uses: ./.github/workflows/setup-game-dlls.yml
secrets:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}

whitespace-format:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -43,6 +52,7 @@ jobs:
run: dotnet format style BopVisualEffects.sln --no-restore --verify-no-changes --verbosity minimal --exclude BopVisualEffects/obj

analyzers:
needs: setup-game-dlls
runs-on: ubuntu-latest

steps:
Expand All @@ -54,8 +64,25 @@ jobs:
with:
dotnet-version: 9.0.x

- name: Download game DLLs artifact
uses: actions/download-artifact@v4
with:
name: game-dlls
path: ~/bits-and-bops/Bits & Bops_Data/Managed

- name: Create BopVisualEffects.user.props
run: |
mkdir -p BopVisualEffects
cat > BopVisualEffects/BopVisualEffects.user.props << EOF
<Project>
<PropertyGroup>
<GameRoot>$HOME/bits-and-bops</GameRoot>
</PropertyGroup>
</Project>
EOF

- name: Restore
run: dotnet restore BopVisualEffects.sln -p:SkipGameReferences=true
run: dotnet restore BopVisualEffects.sln

- name: Verify analyzer rules
run: dotnet format analyzers BopVisualEffects.sln --no-restore --verify-no-changes --verbosity minimal --exclude BopVisualEffects/obj
38 changes: 34 additions & 4 deletions .github/workflows/release-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- name: Checkout master
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
fetch-depth: 0
ref: master

Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
git add BopVisualEffects/BopVisualEffects.csproj
if git diff --cached --quiet; then
echo "No version change detected." >&2
exit 1
exit 0
Comment thread
Brollyy marked this conversation as resolved.
fi

git commit -m "chore: bump version to v${VERSION}"
Expand All @@ -76,15 +77,24 @@ jobs:
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

setup-game-dlls:
uses: ./.github/workflows/setup-game-dlls.yml
secrets:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}

deploy-release-environment:
runs-on: ubuntu-latest
needs: bump-version
needs:
- bump-version
- setup-game-dlls
environment: release

steps:
- name: Checkout bumped commit
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
fetch-depth: 0
ref: ${{ needs.bump-version.outputs.commit_sha }}

Expand All @@ -93,11 +103,28 @@ jobs:
with:
dotnet-version: 9.0.x

- name: Download game DLLs artifact
uses: actions/download-artifact@v4
with:
name: game-dlls
path: ~/bits-and-bops/Bits & Bops_Data/Managed

- name: Create BopVisualEffects.user.props
run: |
mkdir -p BopVisualEffects
cat > BopVisualEffects/BopVisualEffects.user.props << EOF
<Project>
<PropertyGroup>
<GameRoot>$HOME/bits-and-bops</GameRoot>
</PropertyGroup>
</Project>
EOF

- name: Restore
run: dotnet restore BopVisualEffects.sln -p:SkipGameReferences=true
run: dotnet restore BopVisualEffects.sln

- name: Build Release
run: dotnet build BopVisualEffects.sln -c Release -p:SkipGameReferences=true --no-restore
run: dotnet build BopVisualEffects.sln -c Release --no-restore

- name: Package release artifact
run: |
Expand Down Expand Up @@ -128,12 +155,14 @@ jobs:
- name: Checkout master
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
fetch-depth: 0
ref: master

- name: Download built artifact
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.RELEASE_TOKEN }}
name: BopVisualEffects-v${{ needs.bump-version.outputs.version }}
path: dist

Expand All @@ -149,6 +178,7 @@ jobs:
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.RELEASE_TOKEN }}
tag_name: v${{ needs.bump-version.outputs.version }}
name: v${{ needs.bump-version.outputs.version }}
files: dist/*
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/setup-game-dlls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Setup Game DLLs

on:
workflow_call:
secrets:
STEAM_USERNAME:
required: true
STEAM_PASSWORD:
required: true

jobs:
download-dlls:
runs-on: ubuntu-latest
permissions: {}

steps:
- name: Restore game DLLs from cache
id: cache
uses: actions/cache@v4
with:
path: ~/bits-and-bops/Bits & Bops_Data/Managed
key: bits-and-bops-1929290-managed-${{ runner.os }}-v1
restore-keys: bits-and-bops-1929290-managed-${{ runner.os }}-

- name: Download game DLLs using SteamCMD
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
run: |
set -euo pipefail

# Skip download if DLLs are already cached
if [ -d "$HOME/bits-and-bops/Bits & Bops_Data/Managed" ] && [ -n "$(ls -A "$HOME/bits-and-bops/Bits & Bops_Data/Managed" 2>/dev/null)" ]; then
echo "Game DLLs found in cache, skipping download"
exit 0
fi

if [ -z "$STEAM_USERNAME" ] || [ -z "$STEAM_PASSWORD" ]; then
echo "Error: STEAM_USERNAME and STEAM_PASSWORD secrets are not set"
echo "Configure Steam credentials in repository secrets:"
echo "1. Go to Settings > Secrets and variables > Actions"
echo "2. Add STEAM_USERNAME and STEAM_PASSWORD"
echo ""
echo "IMPORTANT: Use a dedicated Steam account WITHOUT 2FA/Steam Guard enabled."
echo "SteamCMD cannot handle 2FA in automated environments."
exit 1
fi

# Install SteamCMD
mkdir -p ~/steamcmd
cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

GAME_DIR="$HOME/bits-and-bops"
mkdir -p "$GAME_DIR"

# Download Bits & Bops (App ID: 1929290)
# NOTE: This will FAIL if the Steam account has 2FA/Steam Guard enabled
echo "Downloading Bits & Bops from Steam..."
./steamcmd.sh +force_install_dir "$GAME_DIR" \
+login "$STEAM_USERNAME" "$STEAM_PASSWORD" \
+app_update 1929290 validate \
+quit

echo "Game DLLs downloaded successfully"
ls "$GAME_DIR/Bits & Bops_Data/Managed/" | wc -l
echo "DLLs found in managed directory"

- name: Upload game DLLs as artifact
uses: actions/upload-artifact@v4
with:
name: game-dlls
path: ~/bits-and-bops/Bits & Bops_Data/Managed
retention-days: 1
18 changes: 8 additions & 10 deletions BopVisualEffects/BopVisualEffects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
</PropertyGroup>

<PropertyGroup>
<SkipGameReferences Condition="'$(SkipGameReferences)' == '' and '$(GITHUB_ACTIONS)' == 'true'">true</SkipGameReferences>
<DefineConstants Condition="'$(SkipGameReferences)' == 'true'">$(DefineConstants);SKIP_GAME_REFERENCES</DefineConstants>
<GameRoot Condition="'$(GameRoot)' == '' and '$(BOP_GAME_ROOT)' != ''">$(BOP_GAME_ROOT)</GameRoot>
<BepInExRoot Condition="'$(GameRoot)' != ''">$(GameRoot)/BepInEx</BepInExRoot>
<BepInExPluginsDir Condition="'$(GameRoot)' != ''">$(GameRoot)/BepInEx/plugins</BepInExPluginsDir>
Expand All @@ -40,24 +38,24 @@
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all"/>
<PackageReference Include="BepInEx.Core" Version="5.*"/>
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*"/>
<PackageReference Include="Unity3D.UnityEngine" Version="2018.3.5.1" IncludeAssets="compile" Condition="'$(SkipGameReferences)' == 'true'"/>
<Reference Include="UnityEngine" Condition="'$(SkipGameReferences)' != 'true' and Exists('$(UnityManagedDir)/UnityEngine.dll')">
<PackageReference Include="Unity3D.UnityEngine" Version="2018.3.5.1" IncludeAssets="compile" Condition="'$(UnityManagedDir)' == ''"/>
<Reference Include="UnityEngine" Condition="Exists('$(UnityManagedDir)/UnityEngine.dll')">
<HintPath>$(UnityManagedDir)/UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule" Condition="'$(SkipGameReferences)' != 'true' and Exists('$(UnityManagedDir)/UnityEngine.CoreModule.dll')">
<Reference Include="UnityEngine.CoreModule" Condition="Exists('$(UnityManagedDir)/UnityEngine.CoreModule.dll')">
<HintPath>$(UnityManagedDir)/UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule" Condition="'$(SkipGameReferences)' != 'true' and Exists('$(UnityManagedDir)/UnityEngine.IMGUIModule.dll')">
<Reference Include="UnityEngine.IMGUIModule" Condition="Exists('$(UnityManagedDir)/UnityEngine.IMGUIModule.dll')">
<HintPath>$(UnityManagedDir)/UnityEngine.IMGUIModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule" Condition="'$(SkipGameReferences)' != 'true' and Exists('$(UnityManagedDir)/UnityEngine.AssetBundleModule.dll')">
<Reference Include="UnityEngine.AssetBundleModule" Condition="Exists('$(UnityManagedDir)/UnityEngine.AssetBundleModule.dll')">
<HintPath>$(UnityManagedDir)/UnityEngine.AssetBundleModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="@(GameLibrary)" Condition="'$(SkipGameReferences)' != 'true' and '$(UnityManagedDir)' != ''">
<Reference Include="@(GameLibrary)" Condition="'$(UnityManagedDir)' != ''">
<HintPath>$(UnityManagedDir)/%(Identity).dll</HintPath>
<Private>false</Private>
</Reference>
Expand All @@ -72,7 +70,7 @@
Condition="Exists('Resources\bopvisualeffects_shaders_linux.assetbundle')" />
</ItemGroup>

<Target Name="ValidateTemplateDependencies" BeforeTargets="ResolveReferences" Condition="'$(SkipGameReferences)' != 'true'">
<Target Name="ValidateTemplateDependencies" BeforeTargets="ResolveReferences">
<ItemGroup>
<MissingGameLibrary Include="@(GameLibrary)"
Condition="'$(UnityManagedDir)' != '' and !Exists('$(UnityManagedDir)/%(Identity).dll')"/>
Expand All @@ -86,7 +84,7 @@

<Target Name="CopyPluginToBepInEx"
AfterTargets="PostBuildEvent"
Condition="'$(SkipGameReferences)' != 'true' and '$(BepInExPluginsDir)' != '' and Exists('$(BepInExPluginsDir)')">
Condition="'$(BepInExPluginsDir)' != '' and Exists('$(BepInExPluginsDir)')">
<Message Importance="High" Text="Copying $(TargetFileName) to $(BepInExPluginsDir)"/>
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(BepInExPluginsDir)" SkipUnchangedFiles="true"/>
</Target>
Expand Down
Loading