| 1 | name: Update examples collection |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | push: |
| 6 | paths: |
| 7 | - 'examples/**' |
| 8 | pull_request: |
| 9 | paths: |
| 10 | - 'examples/**' |
| 11 | |
| 12 | jobs: |
| 13 | build: |
| 14 | runs-on: ubuntu-latest |
| 15 | |
| 16 | steps: |
| 17 | - name: Checkout |
| 18 | uses: actions/checkout@v4 |
| 19 | |
| 20 | - name: Setup emsdk |
| 21 | uses: mymindstorm/setup-emsdk@v14 |
| 22 | with: |
| 23 | version: 'latest' |
| 24 | actions-cache-folder: 'emsdk-cache' |
| 25 | |
| 26 | - name: Clone raylib.com repo to update files |
| 27 | run: | |
| 28 | git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/raysan5/raylib.com.git |
| 29 | shell: bash |
| 30 | |
| 31 | - name: Build and run rexm tool (requires GNU Makefile) |
| 32 | # "rexm validate" validates examples collection, looking for inconsistencies, it does not rebuild examples |
| 33 | # "rexm update" validates and updates all examples with inconsistencies, pushing fixes to raylib and raylib.com repos |
| 34 | # note that rexm calls examples/Makefile.Web internally, so it requires [make] tool available |
| 35 | run: | |
| 36 | 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 |
| 37 | cd "${{ github.workspace }}/src" |
| 38 | make PLATFORM=PLATFORM_DESKTOP |
| 39 | sudo make install |
| 40 | make clean |
| 41 | make PLATFORM=PLATFORM_WEB |
| 42 | cd ../tools/rexm/ |
| 43 | make |
| 44 | export REXM_EXAMPLES_BASE_PATH="${{ github.workspace }}/examples" |
| 45 | export REXM_EXAMPLES_WEB_PATH="${{ github.workspace }}/raylib.com/examples" |
| 46 | export REXM_EXAMPLES_TEMPLATE_FILE_PATH="${{ github.workspace }}/examples/examples_template.c" |
| 47 | export REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH="${{ github.workspace }}/examples/examples_template.png" |
| 48 | export REXM_EXAMPLES_COLLECTION_FILE_PATH="${{ github.workspace }}/examples/examples_list.txt" |
| 49 | export REXM_EXAMPLES_VS2022_SLN_FILE="${{ github.workspace }}/projects/VS2022/raylib.sln" |
| 50 | export EMSDK_PATH="${{ github.workspace }}/emsdk-cache/emsdk-main" |
| 51 | ./rexm validate |
| 52 | shell: bash |
| 53 | |
| 54 | - name: Commit changes to raylib repo (DISABLED) |
| 55 | if: github.event_name == 'push' && false |
| 56 | env: |
| 57 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | run: | |
| 59 | git config --global user.name "github-actions[bot]" |
| 60 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 61 | git add -A |
| 62 | git commit -m "Update examples collection" || echo "git exited with code 1, nothing changed" |
| 63 | git push |
| 64 | shell: bash |
| 65 | |
| 66 | - name: Push changes to raylib.com repo (DISABLED) |
| 67 | if: github.event_name == 'push' && false |
| 68 | run: | |
| 69 | cd raylib.com |
| 70 | git add -A |
| 71 | git commit -m "Update web examples" || echo "git exited with code 1, nothing changed" |
| 72 | git push origin |
| 73 | shell: bash |