Skip to content

Build and Deploy #438

Build and Deploy

Build and Deploy #438

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- release
workflow_dispatch:
inputs:
skip-deploy:
description: Skip Deploy
type: boolean
required: false
default: false
env:
BUILD_TYPE: Release
BUILD_PARALLEL_JOBS: 6
GCC_VERSION: 14
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install packages
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install gcc-${{env.GCC_VERSION}} g++-${{env.GCC_VERSION}} cmake ninja-build
sudo apt-get -y install libcxxopts-dev librange-v3-dev nlohmann-json3-dev libuv1-dev libsqlite3-dev libpng-dev
sudo apt-get -y install python3-yaml python3-pillow
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_C_COMPILER=gcc-${{env.GCC_VERSION}}
-DCMAKE_CXX_COMPILER=g++-${{env.GCC_VERSION}}
-G Ninja
- name: Build
shell: bash
working-directory: ${{github.workspace}}
run: cmake --build build -j ${{ env.BUILD_PARALLEL_JOBS }} --config ${{env.BUILD_TYPE}}
- name: Upload Server Artifact
uses: actions/upload-artifact@v4
with:
name: bangserver
path: build/bangserver
deploy:
if: ${{ ! inputs.skip-deploy }}
runs-on: self-hosted
needs: build
steps:
- name: Download Server Artifact
uses: actions/download-artifact@v4
id: download
with:
name: bangserver
- name: Run Deploy Script
shell: bash
run: ${{ vars.DEPLOY_SCRIPT_PATH }} ${{ steps.download.outputs.download-path }}