99 lines
3.4 KiB
YAML
99 lines
3.4 KiB
YAML
name: Build & deploy web version
|
|
|
|
on:
|
|
push:
|
|
branches: ['main']
|
|
pull_request:
|
|
branches: ['main']
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: 'pages'
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Build WebAssembly & deploy
|
|
runs-on: docker
|
|
|
|
env:
|
|
# Keep in sync with the version table in README.md.
|
|
EMSDK_VERSION: '6.0.6'
|
|
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
|
|
|
- name: Install cmake & friends
|
|
run: |
|
|
set -eo pipefail
|
|
SUDO=""
|
|
[ "$(id -u)" -eq 0 ] || SUDO="sudo"
|
|
$SUDO apt-get update
|
|
$SUDO apt-get install -y --no-install-recommends \
|
|
ca-certificates cmake git ninja-build python3 xz-utils
|
|
cmake --version
|
|
|
|
- name: Install Emscripten
|
|
run: |
|
|
set -eo pipefail
|
|
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
|
cd "$HOME/emsdk"
|
|
./emsdk install "$EMSDK_VERSION"
|
|
./emsdk activate "$EMSDK_VERSION"
|
|
. ./emsdk_env.sh
|
|
# emsdk_env.sh only touches this step's shell, so hand the activated
|
|
# toolchain over to the later steps explicitly.
|
|
{
|
|
echo "EMSDK=$EMSDK"
|
|
echo "EMSDK_NODE=$EMSDK_NODE"
|
|
echo "EM_CONFIG=${EM_CONFIG:-$EMSDK/.emscripten}"
|
|
echo "PATH=$PATH"
|
|
} >> "$GITHUB_ENV"
|
|
|
|
- name: Configure
|
|
run: emcmake cmake -S . -B build-web -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
|
|
- name: Build
|
|
run: cmake --build build-web
|
|
|
|
- name: Check the expected files were produced
|
|
run: |
|
|
set -euo pipefail
|
|
for file in index.html index.js index.wasm index.data; do
|
|
test -s "build-web/web/$file" || { echo "hiányzik: $file"; exit 1; }
|
|
done
|
|
|
|
- name: Upload static site artifact 1
|
|
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
|
|
uses: https://github.com/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5
|
|
with:
|
|
name: pages-deploy-0
|
|
path: build-web/web
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
if: ${{ github.actor != 'renovate-bot' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.head_ref, 'renovate/') }}
|
|
deploy-pages:
|
|
name: Deploy static site artifacts
|
|
needs: deploy
|
|
if: ${{ github.actor != 'renovate-bot' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.head_ref, 'renovate/') && ((github.event_name
|
|
== 'push' && github.ref == 'refs/heads/main')) }}
|
|
runs-on: pages
|
|
container:
|
|
image: node:22-bookworm@sha256:63538dfe497cc29dfafdda25ada09b46db68a3f4cc205abf1f5d6bf0913f3384
|
|
volumes:
|
|
- /pages/platform-game:/pages/platform-game
|
|
concurrency:
|
|
group: pages-deploy-platform-game
|
|
cancel-in-progress: false
|
|
steps:
|
|
- name: Download static site artifact 1
|
|
uses: https://github.com/actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
|
|
with:
|
|
name: pages-deploy-0
|
|
path: build-web/web
|
|
- name: Deploy to nginx pages mount
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
uses: https://git.schmelczer.dev/andras/ci-actions/deploy-pages@18419c79a58572be1bb3759b334f43306be44a29
|
|
with:
|
|
source: build-web/web
|
|
target: platform-game
|