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
8 changes: 8 additions & 0 deletions .github/plugin-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"plugins": [
{ "component": "BossBars", "path": "src/BossBars", "slug": "void-bossbars" },
{ "component": "Menus", "path": "src/Menus", "slug": "void-menus" },
{ "component": "PlayerPositions", "path": "src/PlayerPositions", "slug": "void-player-positions" },
{ "component": "TabLists", "path": "src/TabLists", "slug": "void-tab-lists" }
]
}
142 changes: 40 additions & 102 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,33 @@ on:
required: true

jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.read.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Read plugin manifest
id: read
run: |
set -euo pipefail
jq -e '.plugins | length > 0' .github/plugin-manifest.json > /dev/null
dup=$(jq -r '.plugins[].slug' .github/plugin-manifest.json | sort | uniq -d)
if [ -n "$dup" ]; then echo "::error::duplicate slug(s): $dup"; exit 1; fi
echo "matrix=$(jq -c '.plugins' .github/plugin-manifest.json)" >> "$GITHUB_OUTPUT"

build:
needs: set-matrix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_MESSAGE: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || github.event.head_commit.message }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -22,115 +44,31 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet-version }}
cache: true
cache-dependency-path: 'src/**/*.csproj'

# region Build BossBars
- name: Build BossBars without Version
if: ${{ fromJSON(inputs.release-info)['src/BossBars--release_created'] != 'true' }}
run: dotnet build src/BossBars --configuration Release

- name: Build BossBars
if: ${{ fromJSON(inputs.release-info)['src/BossBars--release_created'] == 'true' }}
run: dotnet build src/BossBars --configuration Release /p:Version=${{ fromJSON(inputs.release-info)['src/BossBars--version'] }}

- name: Publish BossBars
if: ${{ fromJSON(inputs.release-info)['src/BossBars--release_created'] == 'true' }}
run: dotnet publish src/BossBars --output artifacts --configuration Release --no-build /p:DebugType=embedded /p:Version=${{ fromJSON(inputs.release-info)['src/BossBars--version'] }}

- name: Rename BossBars Artifact
if: ${{ fromJSON(inputs.release-info)['src/BossBars--release_created'] == 'true' }}
shell: bash
run: mv artifacts/Void.Plugins.BossBars.dll artifacts/void-bossbars.dll

- name: Upload a BossBars Build Artifact
if: ${{ fromJSON(inputs.release-info)['src/BossBars--release_created'] == 'true' }}
uses: actions/upload-artifact@v4
with:
name: void-bossbars.dll
path: artifacts/void-bossbars.dll
compression-level: 9
if-no-files-found: error
# endregion Build BossBars

# region Build Menus
- name: Build Menus without Version
if: ${{ fromJSON(inputs.release-info)['src/Menus--release_created'] != 'true' }}
run: dotnet build src/Menus --configuration Release

- name: Build Menus
if: ${{ fromJSON(inputs.release-info)['src/Menus--release_created'] == 'true' }}
run: dotnet build src/Menus --configuration Release /p:Version=${{ fromJSON(inputs.release-info)['src/Menus--version'] }}

- name: Publish Menus
if: ${{ fromJSON(inputs.release-info)['src/Menus--release_created'] == 'true' }}
run: dotnet publish src/Menus --output artifacts --configuration Release --no-build /p:DebugType=embedded /p:Version=${{ fromJSON(inputs.release-info)['src/Menus--version'] }}

- name: Rename Menus Artifact
if: ${{ fromJSON(inputs.release-info)['src/Menus--release_created'] == 'true' }}
shell: bash
run: mv artifacts/Void.Plugins.Menus.dll artifacts/void-menus.dll

- name: Upload a Menus Build Artifact
if: ${{ fromJSON(inputs.release-info)['src/Menus--release_created'] == 'true' }}
uses: actions/upload-artifact@v4
with:
name: void-menus.dll
path: artifacts/void-menus.dll
compression-level: 9
if-no-files-found: error
# endregion Build Menus

# region Build PlayerPositions
- name: Build PlayerPositions without Version
if: ${{ fromJSON(inputs.release-info)['src/PlayerPositions--release_created'] != 'true' }}
run: dotnet build src/PlayerPositions --configuration Release

- name: Build PlayerPositions
if: ${{ fromJSON(inputs.release-info)['src/PlayerPositions--release_created'] == 'true' }}
run: dotnet build src/PlayerPositions --configuration Release /p:Version=${{ fromJSON(inputs.release-info)['src/PlayerPositions--version'] }}

- name: Publish PlayerPositions
if: ${{ fromJSON(inputs.release-info)['src/PlayerPositions--release_created'] == 'true' }}
run: dotnet publish src/PlayerPositions --output artifacts --configuration Release --no-build /p:DebugType=embedded /p:Version=${{ fromJSON(inputs.release-info)['src/PlayerPositions--version'] }}

- name: Rename PlayerPositions Artifact
if: ${{ fromJSON(inputs.release-info)['src/PlayerPositions--release_created'] == 'true' }}
shell: bash
run: mv artifacts/Void.Plugins.PlayerPositions.dll artifacts/void-player-positions.dll

- name: Upload a PlayerPositions Build Artifact
if: ${{ fromJSON(inputs.release-info)['src/PlayerPositions--release_created'] == 'true' }}
uses: actions/upload-artifact@v4
with:
name: void-player-positions.dll
path: artifacts/void-player-positions.dll
compression-level: 9
if-no-files-found: error
# endregion Build PlayerPositions

# region Build TabLists
- name: Build TabLists without Version
if: ${{ fromJSON(inputs.release-info)['src/TabLists--release_created'] != 'true' }}
run: dotnet build src/TabLists --configuration Release
- name: Build ${{ matrix.component }} without Version
if: ${{ fromJSON(inputs.release-info).releases_created != 'true' && fromJSON(inputs.release-info)[format('{0}--release_created', matrix.path)] != 'true' }}
run: dotnet build ${{ matrix.path }} --configuration Release

- name: Build TabLists
if: ${{ fromJSON(inputs.release-info)['src/TabLists--release_created'] == 'true' }}
run: dotnet build src/TabLists --configuration Release /p:Version=${{ fromJSON(inputs.release-info)['src/TabLists--version'] }}
- name: Build ${{ matrix.component }}
if: ${{ fromJSON(inputs.release-info)[format('{0}--release_created', matrix.path)] == 'true' }}
run: dotnet build ${{ matrix.path }} --configuration Release /p:Version=${{ fromJSON(inputs.release-info)[format('{0}--version', matrix.path)] }}

- name: Publish TabLists
if: ${{ fromJSON(inputs.release-info)['src/TabLists--release_created'] == 'true' }}
run: dotnet publish src/TabLists --output artifacts --configuration Release --no-build /p:DebugType=embedded /p:Version=${{ fromJSON(inputs.release-info)['src/TabLists--version'] }}
- name: Publish ${{ matrix.component }}
if: ${{ fromJSON(inputs.release-info)[format('{0}--release_created', matrix.path)] == 'true' }}
run: dotnet publish ${{ matrix.path }} --output artifacts --configuration Release --no-build /p:DebugType=embedded /p:Version=${{ fromJSON(inputs.release-info)[format('{0}--version', matrix.path)] }}

- name: Rename TabLists Artifact
if: ${{ fromJSON(inputs.release-info)['src/TabLists--release_created'] == 'true' }}
- name: Rename ${{ matrix.component }} Artifact
if: ${{ fromJSON(inputs.release-info)[format('{0}--release_created', matrix.path)] == 'true' }}
shell: bash
run: mv artifacts/Void.Plugins.TabLists.dll artifacts/void-tab-lists.dll
run: mv artifacts/Void.Plugins.${{ matrix.component }}.dll artifacts/${{ matrix.slug }}.dll

- name: Upload a TabLists Build Artifact
if: ${{ fromJSON(inputs.release-info)['src/TabLists--release_created'] == 'true' }}
- name: Upload ${{ matrix.component }} Build Artifact
if: ${{ fromJSON(inputs.release-info)[format('{0}--release_created', matrix.path)] == 'true' }}
uses: actions/upload-artifact@v4
with:
name: void-tab-lists.dll
path: artifacts/void-tab-lists.dll
name: ${{ matrix.slug }}.dll
path: artifacts/${{ matrix.slug }}.dll
compression-level: 9
if-no-files-found: error
# endregion Build TabLists
106 changes: 86 additions & 20 deletions .github/workflows/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,96 @@ jobs:
path: artifacts
merge-multiple: true

- name: Upload BossBars Release Artifacts
if: ${{ fromJSON(inputs.release-info)['src/BossBars--release_created'] == 'true' }}
- name: Resolve prior plugin DLLs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_INFO: ${{ inputs.release-info }}
shell: bash
run: |
gh release upload ${{ fromJSON(inputs.release-info)['src/BossBars--tag_name'] }} artifacts/void-bossbars.dll
set -euo pipefail
mkdir -p artifacts

- name: Upload Menus Release Artifacts
if: ${{ fromJSON(inputs.release-info)['src/Menus--release_created'] == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ fromJSON(inputs.release-info)['src/Menus--tag_name'] }} artifacts/void-menus.dll
declare -A SKIPPED

- name: Upload PlayerPositions Release Artifacts
if: ${{ fromJSON(inputs.release-info)['src/PlayerPositions--release_created'] == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ fromJSON(inputs.release-info)['src/PlayerPositions--tag_name'] }} artifacts/void-player-positions.dll
mapfile -t plugins < <(jq -r '.plugins[] | "\(.component)|\(.slug).dll|\(.path)--release_created"' .github/plugin-manifest.json)

for entry in "${plugins[@]}"; do
IFS='|' read -r component dll key <<< "$entry"
released=$(echo "$RELEASE_INFO" | jq -r --arg k "$key" '.[$k] // "false"')

if [ "$released" = "true" ]; then
echo "::notice::$component released this run — using freshly built $dll"
continue
fi

if [ -f "artifacts/$dll" ]; then
echo "::notice::Trusting pre-existing $dll in artifacts/"
continue
fi

releases_json=$(gh release list --limit 200 --json tagName,createdAt 2>&1) || {
echo "::error::gh release list failed for $component: $releases_json"
exit 1
}
latest_tag=$(echo "$releases_json" | jq -r \
--arg c "$component" \
'[.[] | select(.tagName | test("^" + $c + "-v[0-9]+\\.[0-9]+\\.[0-9]+$"))] | sort_by(.createdAt) | reverse | .[0].tagName' \
2>/dev/null || echo "null")

if [ -z "$latest_tag" ] || [ "$latest_tag" = "null" ]; then
echo "::warning::No stable prior release found for $component — $dll will be omitted"
SKIPPED[$dll]=1
continue
fi

echo "::notice::Fetching $dll from $latest_tag"
if ! gh release download "$latest_tag" --pattern "$dll" --dir artifacts --clobber 2>&1; then
echo "::warning::Failed to download $dll from $latest_tag — skipping"
SKIPPED[$dll]=1
fi
done

echo "=== Bundle manifest ==="
shopt -s nullglob
for f in artifacts/void-*.dll; do echo " $f"; done
shopt -u nullglob

missing=()
mapfile -t expected_dlls < <(jq -r '.plugins[] | "\(.slug).dll"' .github/plugin-manifest.json)
for dll in "${expected_dlls[@]}"; do
if [ -z "${SKIPPED[$dll]+x}" ] && [ ! -f "artifacts/$dll" ]; then
missing+=("$dll")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
echo "::error::Expected DLLs missing from artifacts: ${missing[*]}"
exit 1
fi

- name: Upload TabLists Release Artifacts
if: ${{ fromJSON(inputs.release-info)['src/TabLists--release_created'] == 'true' }}
- name: Upload Release bundles
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_INFO: ${{ inputs.release-info }}
shell: bash
run: |
gh release upload ${{ fromJSON(inputs.release-info)['src/TabLists--tag_name'] }} artifacts/void-tab-lists.dll
set -euo pipefail
shopt -s nullglob
files=(artifacts/void-*.dll)
if [ ${#files[@]} -eq 0 ]; then
echo "::error::No DLLs found in artifacts/ for bundle upload"
exit 1
fi
while IFS='|' read -r component path slug; do
released=$(jq -r --arg k "${path}--release_created" '.[$k] // "false"' <<<"$RELEASE_INFO")
if [ "$released" != "true" ]; then
echo "::notice::Skipping $component bundle upload (release_created != true)"
continue
fi
tag=$(jq -r --arg k "${path}--tag_name" '.[$k]' <<<"$RELEASE_INFO")
if [ -z "$tag" ] || [ "$tag" = "null" ]; then
echo "::error::Missing tag_name for $component (path=$path)"
exit 1
fi
echo "Uploading ${#files[@]} DLL(s) to $tag ($component)"
gh release upload "$tag" "${files[@]}" --clobber
done < <(jq -r '.plugins[] | "\(.component)|\(.path)|\(.slug)"' .github/plugin-manifest.json)
Loading
Loading