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
14 changes: 8 additions & 6 deletions .github/workflows/electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ jobs:
cd electron/
rm -rf build/
npm run build
zip -r linux.zip build/build-linux*/
zip -r windows.zip build/build-win*/
zip -r macos.zip build/build-mas*/
mv build/ csf/
zip -r linux.zip csf/build-linux*/
zip -r windows.zip csf/build-win*/
zip -r macos.zip csf/build-mas*/
rm -rf csf/

- name: "Publish Linux Artifact"
timeout-minutes: 5
Expand All @@ -49,7 +51,7 @@ jobs:
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/zip" \
"https://uploads.github.com/repos/solcloud/Counter-Strike/releases/${RELEASE_ID}/assets?name=client-linux.zip" \
"https://uploads.github.com/repos/solcloud/Counter-Strike/releases/${RELEASE_ID}/assets?name=csf-client-linux.zip" \
--data-binary "@electron/linux.zip"

- name: "Publish Windows Artifact"
Expand All @@ -65,7 +67,7 @@ jobs:
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/zip" \
"https://uploads.github.com/repos/solcloud/Counter-Strike/releases/${RELEASE_ID}/assets?name=client-windows.zip" \
"https://uploads.github.com/repos/solcloud/Counter-Strike/releases/${RELEASE_ID}/assets?name=csf-client-windows.zip" \
--data-binary "@electron/windows.zip"

- name: "Publish MacOS Artifact"
Expand All @@ -81,5 +83,5 @@ jobs:
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/zip" \
"https://uploads.github.com/repos/solcloud/Counter-Strike/releases/${RELEASE_ID}/assets?name=client-macos.zip" \
"https://uploads.github.com/repos/solcloud/Counter-Strike/releases/${RELEASE_ID}/assets?name=csf-client-macos.zip" \
--data-binary "@electron/macos.zip"
100 changes: 100 additions & 0 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
env:
PHP_VERSION: "8.4.12"

name: "Server"
on:
release:
types: [created]

jobs:
server-build:
if: github.actor == 'solcloud'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: "Install Linux dependencies"
timeout-minutes: 4
run: |
sudo apt-get update && sudo apt-get install -y \
composer zip tar curl

- name: "Install Composer dependencies"
timeout-minutes: 6
run: |
composer install -a --no-dev

- name: "Pack into phar"
timeout-minutes: 4
run: |
curl -Lo box.phar "https://github.com/box-project/box/releases/latest/download/box.phar"
ln -s cli/server.php index.php
php box.phar compile

- name: "Pack into static executable"
timeout-minutes: 6
run: |
echo "Packing for linux"
curl -Lo linux.tar.gz "https://dl.static-php.dev/static-php-cli/common/php-${PHP_VERSION}-micro-linux-x86_64.tar.gz"
tar xf linux.tar.gz
cat micro.sfx index.phar > server-linux-x86_64
rm micro.sfx
echo "Packing for mac"
curl -Lo mac.tar.gz "https://dl.static-php.dev/static-php-cli/common/php-${PHP_VERSION}-micro-macos-x86_64.tar.gz"
tar xf mac.tar.gz
cat micro.sfx index.phar > server-mac-x86_64
rm micro.sfx
echo "Packing for windows"
curl -Lo windows.zip "https://dl.static-php.dev/static-php-cli/windows/spc-max/php-${PHP_VERSION}-micro-win.zip"
unzip windows.zip
cat micro.sfx index.phar > server-windows-x86_64
rm micro.sfx

- name: "Publish Linux server executable"
timeout-minutes: 6
env:
RELEASE_ID: ${{ github.event.release.id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/coopryan/csf/releases/${RELEASE_ID}/assets?name=csf-server-linux" \
--data-binary "@server-linux-x86_64"

- name: "Publish macOS server executable"
timeout-minutes: 6
env:
RELEASE_ID: ${{ github.event.release.id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/coopryan/csf/releases/${RELEASE_ID}/assets?name=csf-server-mac" \
--data-binary "@server-mac-x86_64"

- name: "Publish Windows server executable"
timeout-minutes: 6
env:
RELEASE_ID: ${{ github.event.release.id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"https://uploads.github.com/repos/coopryan/csf/releases/${RELEASE_ID}/assets?name=csf-server-windows.bat" \
--data-binary "@server-windows-x86_64"
4 changes: 2 additions & 2 deletions cli/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$port = (int)($argv[2] ?? 8080);
$debug = in_array('--debug', $argv);
$bindAddress = "udp://0.0.0.0:$port";
$map = new Maps\DefaultMap();
$map = Maps\DefaultMap::class;
/////

$settings = new ServerSetting($playersMax); // must be first for correctly setting the global tickRate (Util::$TICK_RATE)
Expand All @@ -23,7 +23,7 @@
$logger->info("Preparing game for launch, please wait...");

$game = ($debug ? GameFactory::createDebug() : GameFactory::createDefaultCompetitive());
$game->loadMap($map);
$game->loadMap(new $map);

$logger->info("Starting server on '{$bindAddress}', waiting maximum of '{$settings->warmupWaitSec}' sec for '{$playersMax}' player" . ($playersMax > 1 ? 's' : '') . " to connect.");
$net = new ClueSocket($bindAddress);
Expand Down