Prevent "Collection was modified" #327
This file contains hidden or 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
| name: Build beta | |
| env: | |
| SLN_PATH: Source/ | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - dev | |
| paths-ignore: | |
| - 'README.md' | |
| jobs: | |
| build: | |
| name: Build beta | |
| runs-on: ubuntu-latest | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.x | |
| - name: Install Mod Dependencies | |
| run: dotnet restore ${{ env.SLN_PATH }} | |
| - name: Build Mod | |
| run: dotnet build ${{ env.SLN_PATH }} --configuration Release --no-restore | |
| - name: Publish Server (Windows) | |
| run: dotnet publish ${{ env.SLN_PATH }}Server/Server.csproj --configuration Release --runtime win-x64 --self-contained false -p:UseAppHost=true -o output/Server/Windows | |
| - name: Publish Server (Linux) | |
| run: dotnet publish ${{ env.SLN_PATH }}Server/Server.csproj --configuration Release --runtime linux-x64 --self-contained false -p:UseAppHost=true -o output/Server/Linux | |
| - name: Add Server Launchers | |
| run: | | |
| cat > output/Server/Linux/Server.sh <<'EOF' | |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" | |
| exec dotnet "$SCRIPT_DIR/Server.dll" "$@" | |
| EOF | |
| chmod +x output/Server/Linux/Server.sh | |
| - name: Package files | |
| run: | | |
| sed -i "s/<name>\(.*\)<\/name>\$/<name>\1 [Continuous]<\/name>/" About/About.xml | |
| mkdir -p output/Multiplayer | |
| mv About/ Assemblies/ AssembliesCustom/ Defs/ Languages/ Textures/ output/Multiplayer | |
| cd output/ | |
| zip -r ../Multiplayer-beta.zip Multiplayer/ | |
| zip -r ../Server-beta.zip Server/ | |
| cd ../ | |
| - name: Upload Mod Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Multiplayer-beta | |
| path: output/ | |
| - name: Clean up last release | |
| continue-on-error: true | |
| run: | | |
| gh release delete --cleanup-tag --yes "continuous" | |
| - name: Upload new release | |
| run: | | |
| gh release create --target "${{ github.sha }}" --title "Continuous" --notes-file ".github/workflows/alpha-notes.md" --draft "continuous" | |
| gh release upload "continuous" Multiplayer-beta.zip Server-beta.zip | |
| gh release edit "continuous" --draft=false |