name: Update examples collection
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
- '.github/workflows/update_examples.yml'
|
|
- 'examples/**'
|
|
- 'tools/rexm/**'
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/update_examples.yml'
|
|
- 'examples/**'
|
|
- 'tools/rexm/**'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup emsdk
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 'latest'
|
|
actions-cache-folder: 'emsdk-cache'
|
|
|
|
- name: Clone raylib.com repo to update files
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY_OWNER/raylib.com.git "${{ github.workspace }}/../raylib.com"
|
|
shell: bash
|
|
|
|
- name: Build and run rexm tool (GNU Makefile)
|
|
# rexm should update all required files in raylib and even raylib.com repo,
|
|
# but not sure if it can do that from an Action, maybe it requires manual copy
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y libopengl0 libglu1-mesa libx11-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libgl1-mesa-dev libglu1-mesa-dev
|
|
cd "${{ github.workspace }}/src"
|
|
make
|
|
sudo make install
|
|
cd ../tools/rexm/
|
|
clang rexm.c -lraylib -lc -lm -o rexm
|
|
export REXM_EXAMPLES_BASE_PATH="${{ github.workspace }}/examples"
|
|
export REXM_EXAMPLES_WEB_PATH="${{ github.workspace }}/../raylib.com/examples"
|
|
export REXM_EXAMPLES_TEMPLATE_FILE_PATH="${{ github.workspace }}examples/examples_template.c"
|
|
export REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH="${{ github.workspace }}examples/examples_template.png"
|
|
export REXM_EXAMPLES_COLLECTION_FILE_PATH="${{ github.workspace }}/examples/examples_list.txt"
|
|
export REXM_EXAMPLES_VS2022_SLN_FILE="${{ github.workspace }}/projects/VS2022/raylib.sln"
|
|
export EMSDK_PATH="${{ github.workspace }}/emsdk-cache/emsdk-main"
|
|
./rexm update
|
|
cd ../..
|
|
shell: bash
|
|
|
|
- name: Commit changes to raylib repo
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add -A
|
|
git commit -m "Update examples collection" || echo "git exited with code 1, nothing changed"
|
|
git push
|
|
shell: bash
|
|
|
|
- name: Build examples
|
|
run: |
|
|
cd "${{ github.workspace }}/src"
|
|
make clean
|
|
make PLATFORM=PLATFORM_WEB
|
|
cd ../examples
|
|
make PLATFORM=PLATFORM_WEB
|
|
for category in core shapes textures models shaders text audio; do
|
|
cd $category
|
|
target_dir="${{ github.workspace }}/../raylib.com/examples/$category/"
|
|
find . -type f -name "*.wasm" -exec cp {} "$target_dir" \;
|
|
find . -type f -name "*.html" -exec cp {} "$target_dir" \;
|
|
find . -type f -name "*.js" -exec cp {} "$target_dir" \;
|
|
find . -type f -name "*.data" -exec cp {} "$target_dir" \;
|
|
cd ..
|
|
done
|
|
- name: Push changes to raylib.com repo
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
cd "${{ github.workspace }}/../raylib.com"
|
|
git add examples
|
|
git commit -m "Update web examples"
|
|
git push origin
|
|
shell: bash
|