Remove Log Kill Feed Alignment #259
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: CI-CD-Pipeline | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- '**/Si_*/**' | |
- '!*.md' | |
- '!*.json' | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
get-commit-number: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate the commit number | |
id: commit-number | |
run: | | |
echo "comnum=$(git log --oneline | wc -l)" >> "$GITHUB_OUTPUT" | |
outputs: | |
comnum: ${{ steps.commit-number.outputs.comnum }} | |
find-if-nuget-update-is-needed: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: checkAdminMod | |
with: | |
filters: | | |
admin-updated: | |
- 'Si_AdminMod/**' | |
# run only if 'workflows' files were changed | |
- name: adminmod updated | |
if: steps.checkAdminMod.outputs.admin-updated == 'true' | |
run: echo "AdminMod Update Found." | |
# run only if not 'workflows' files were changed | |
- name: no adminmod updates | |
if: steps.checkAdminMod.outputs.admin-updated != 'true' | |
run: echo "No AdminMod Update Found. Skipping nuget packages..." | |
outputs: | |
admin-updated: ${{ steps.checkAdminMod.outputs.admin-updated }} | |
create-package: | |
needs: [ find-if-nuget-update-is-needed, get-commit-number ] | |
if: needs.find-if-nuget-update-is-needed.outputs.admin-updated == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: References | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ secrets.PRIV_R }} | |
token: ${{ secrets.FGAT_PRIV_R }} | |
path: references | |
- name: Copy References | |
run: | | |
cp -r references/. include | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore | |
run: | | |
cd Si_AdminMod | |
dotnet restore | |
- name: Build | |
run: | | |
cd Si_AdminMod | |
dotnet build --no-restore -c ${{env.BUILD_TYPE}} | |
- name: Test | |
run: | | |
cd Si_AdminMod | |
dotnet test -c ${{env.BUILD_TYPE}} --no-build | |
- name: Pack NuGet | |
run: | | |
cd Si_AdminMod | |
dotnet pack -c ${{env.BUILD_TYPE}} --no-build --output . /p:Version=2.0.${{ needs.get-commit-number.outputs.comnum }} | |
- name: Push to NuGet | |
run: | | |
cd Si_AdminMod | |
dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_ADMINMOD_API_KEY}} --source https://api.nuget.org/v3/index.json | |
- name: Wait for publishing | |
uses: juliangruber/[email protected] | |
with: | |
time: 10m | |
fanout: | |
if: ${{ !failure() && !cancelled() }} | |
needs: [ find-if-nuget-update-is-needed, create-package ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate matrix with all modules of the repo | |
id: set-matrix | |
run: | | |
echo "matrix=$(ls -l | grep '^d' | awk -F ' ' '{print $9}' | grep -Po 'Si.*' | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> "$GITHUB_OUTPUT" | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
build: | |
if: ${{ !failure() && !cancelled() }} | |
needs: fanout | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
path: ${{ fromJson(needs.fanout.outputs.matrix) }} | |
steps: | |
- name: Prepare environment sha | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Prepare environment pwd | |
shell: bash | |
run: echo "START_DIR=`pwd`" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: References | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ secrets.PRIV_R }} | |
token: ${{ secrets.FGAT_PRIV_R }} | |
path: references | |
- name: Copy References | |
run: | | |
cp -r references/. include | |
- name: Download QList | |
uses: robinraju/[email protected] | |
with: | |
repository: "dodad-2/QList" | |
latest: true | |
fileName: "QList.dll" | |
tarBall: false | |
zipBall: false | |
- name: Move QList | |
run: | | |
mv QList.dll include/ | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: | | |
cd ${{ matrix.path }} | |
dotnet restore | |
- name: Build | |
run: | | |
cd ${{ matrix.path }} | |
dotnet build --no-restore -c ${{env.BUILD_TYPE}} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.path }}-build-${{ env.GITHUB_SHA_SHORT }} | |
path: ${{ matrix.path }}/bin/${{env.BUILD_TYPE}}/**/${{ matrix.path }}.dll | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dedicated-server-${{ matrix.path }}-build-${{ env.GITHUB_SHA_SHORT }} | |
path: ${{ matrix.path }}/bin/${{env.BUILD_TYPE}}/netstandard2.1/${{ matrix.path }}.dll | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: listen-server-${{ matrix.path }}-build-${{ env.GITHUB_SHA_SHORT }} | |
path: ${{ matrix.path }}/bin/${{env.BUILD_TYPE}}/net6.0/${{ matrix.path }}.dll | |
publish: | |
if: github.event_name == 'push' && ${{ !failure() && !cancelled() }} | |
permissions: | |
contents: write | |
needs: [ get-commit-number, build, fanout ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare env | |
shell: bash | |
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: . | |
- name: Make output paths | |
run: | | |
mkdir -p release/dedi/Plugins | |
mkdir -p release/dedi/Mods/disabled | |
mkdir -p release/dedi/UserData | |
mkdir -p release/listen/Plugins | |
mkdir -p release/listen/Mods/disabled | |
mkdir -p release/listen/UserData | |
cp rungame.bat release/dedi/rungame.bat | |
cp launch.bat release/dedi/launch.bat | |
cp LICENSE release/dedi/UserData/Mod-License.txt | |
cp LICENSE release/listen/UserData/Mod-License.txt | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: dedicated-server-* | |
merge-multiple: true | |
path: release/dedi/Mods | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: listen-server-* | |
merge-multiple: true | |
path: release/listen/Mods | |
- name: Download Updater Plugin | |
uses: robinraju/[email protected] | |
with: | |
repository: "data-bomb/MelonLoader_SilicaUpdater" | |
latest: true | |
fileName: "*.dll" | |
tarBall: false | |
zipBall: false | |
- name: Download Discord Status Plugin | |
uses: robinraju/[email protected] | |
with: | |
repository: "data-bomb/MelonLoader_SilicaDiscordRP" | |
latest: true | |
fileName: "*.dll" | |
tarBall: false | |
zipBall: false | |
- name: Move Plugins into Release | |
run: | | |
mv Si_ModUpdater.dll release/dedi/Plugins | |
mv Si_ModUpdater_ListenServer.dll release/listen/Plugins/Si_ModUpdater.dll | |
mv Si_DiscordStatus.dll release/dedi/Plugins | |
mv Si_DiscordStatus_ListenServer.dll release/listen/Plugins/Si_DiscordStatus.dll | |
- name: Disable Deprecated Mods | |
run: | | |
# AutoTeamsSelect was addressed with a game update to vote on the next mode | |
mv release/dedi/Mods/Si_AutoTeamsSelect.dll release/dedi/Mods/disabled | |
mv release/listen/Mods/Si_AutoTeamsSelect.dll release/listen/Mods/disabled | |
# FriendlyFireLimits is disabled by default | |
mv release/dedi/Mods/Si_FriendlyFireLimits.dll release/dedi/Mods/disabled | |
mv release/listen/Mods/Si_FriendlyFireLimits.dll release/listen/Mods/disabled | |
# Tech Glitch is disabled because the discrepancy is happening on the server side (not client side) | |
mv release/dedi/Mods/Si_TechGlitch.dll release/dedi/Mods/disabled | |
mv release/listen/Mods/Si_TechGlitch.dll release/listen/Mods/disabled | |
- name: Zip Builds | |
run: | | |
(cd release/dedi && zip -qq -r ../../DedicatedServer-v${{ needs.get-commit-number.outputs.comnum }}-${{ env.GITHUB_SHA_SHORT }}.zip *) | |
(cd release/listen && zip -qq -r ../../ListenServer-v${{ needs.get-commit-number.outputs.comnum }}-${{ env.GITHUB_SHA_SHORT }}.zip *) | |
- name: Release | |
uses: softprops/action-gh-release@975c1b265e11dd76618af1c374e7981f9a6ff44a | |
with: | |
tag_name: v${{ needs.get-commit-number.outputs.comnum }} | |
files: | | |
DedicatedServer-v${{ needs.get-commit-number.outputs.comnum }}-${{ env.GITHUB_SHA_SHORT }}.zip | |
ListenServer-v${{ needs.get-commit-number.outputs.comnum }}-${{ env.GITHUB_SHA_SHORT }}.zip |