Skip to content

Commit e796b00

Browse files
[workflows] (almost) rewrite update_examples.yml workflow (#5130)
* debug print the working directory * trigger it on any branch (temporarily) * nope, wrong fix * dummy commit to trigger the workflow * lets see if this works * trigger the workflow when updating it * nice typo * add missing dollar signs * debug list the contents of the repository * dir/s instead of ls * remove this, no longer needed * backslashes maybe? windows... * this should be a forward slash * remove no longer needed spam * debug check if examples dir exists * LOG is disabled apparently * ... * temporarily disable this step to save time * ubuntu maybe * bash * install deps * link libc * link libm * now to test the rest * emsdk is back * add missing shaders * Update examples collection * add indentation * remove emsdk cache * ignore emsdk cache * Update examples collection * fix errors with the find command * remove emsdk cache now * i forgot to actually add it to gitignore * fix error with git not finding anything to commit * global config instead of repo specific * clone raylib.com repo under the same owner as the raylib repo owner * add proper access token * reorganize it all * remove non-existent example * clone raylib.com before running rexm * no extra slash * Update examples collection * copy updated examples to the right place * remove unnecessary debug line from rexm.c * Update examples collection * Update examples collection * use hardcoded absolute path to make * add debug line * semicolon * fix wrong handling of make path * fix wrong cwd * rebuild raylib for web after installing it * cleanuo * conditionally push to repos, never on PR * build rexm with make for consistency * remove workflow run results * add back the examples report files * pause automatic commits * revert makefile changes * readd removed vs2022 project file --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 04a3ab0 commit e796b00

2 files changed

Lines changed: 47 additions & 40 deletions

File tree

.github/workflows/update_examples.yml

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ on:
44
workflow_dispatch:
55
push:
66
paths:
7+
- '.github/workflows/update_examples.yml'
78
- 'examples/**'
9+
- 'tools/rexm/**'
810
pull_request:
911
paths:
12+
- '.github/workflows/update_examples.yml'
1013
- 'examples/**'
14+
- 'tools/rexm/**'
1115

1216
jobs:
1317
build:
14-
runs-on: windows-latest
18+
runs-on: ubuntu-latest
1519

1620
steps:
1721
- name: Checkout
@@ -22,51 +26,51 @@ jobs:
2226
with:
2327
version: 'latest'
2428
actions-cache-folder: 'emsdk-cache'
25-
26-
- name: Setup MSBuild
27-
uses: microsoft/setup-msbuild@v2
28-
29-
- name: Clone raylib.com repo to update files
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Clone raylib.com repo
3231
run: |
33-
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/raysan5/raylib.com.git
34-
shell: cmd
35-
36-
- name: Build and run rexm tool (VS2022 solution)
32+
git clone https://x-access-token:${{ secrets.RAYLIB_DOT_COM_REPO_TOKEN }}@github.com/$GITHUB_REPOSITORY_OWNER/raylib.com.git
33+
shell: bash
34+
35+
- name: Build and run rexm tool (GNU Makefile)
3736
# rexm should update all required files in raylib and even raylib.com repo,
3837
# but not sure if it can do that from an Action, maybe it requires manual copy
3938
run: |
40-
cd tools/rexm/VS2022
41-
msbuild.exe rexm.sln /target:rexm /property:Configuration=Release /property:Platform=x64
42-
cd ${{ github.workspace }}\tools\rexm\VS2022\build\rexm\bin\x64\Release
43-
set REXM_EXAMPLES_BASE_PATH=${{ github.workspace }}\examples
44-
set REXM_EXAMPLES_WEB_PATH=${{ github.workspace }}\..\raylib.com\examples
45-
set REXM_EXAMPLES_TEMPLATE_FILE_PATH=${{ github.workspace }}\examples\examples_template.c
46-
set REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH=${{ github.workspace }}\examples\examples_template.png
47-
set REXM_EXAMPLES_COLLECTION_FILE_PATH=${{ github.workspace }}\examples\examples_list.txt
48-
set REXM_EXAMPLES_VS2022_SLN_FILE=${{ github.workspace }}\projects\VS2022\raylib.sln
49-
set EMSDK_PATH=${{ github.workspace }}/emsdk-cache/emsdk-main
50-
dir
51-
rexm.exe build core_basic_window
52-
cd ${{ github.workspace }}\..
53-
dir
54-
shell: cmd
55-
39+
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
40+
cd "${{ github.workspace }}/src"
41+
make
42+
sudo make install
43+
make clean
44+
make PLATFORM=PLATFORM_WEB
45+
cd ../tools/rexm/
46+
make
47+
export REXM_EXAMPLES_BASE_PATH="${{ github.workspace }}/examples"
48+
export REXM_EXAMPLES_WEB_PATH="${{ github.workspace }}/raylib.com/examples"
49+
export REXM_EXAMPLES_TEMPLATE_FILE_PATH="${{ github.workspace }}/examples/examples_template.c"
50+
export REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH="${{ github.workspace }}/examples/examples_template.png"
51+
export REXM_EXAMPLES_COLLECTION_FILE_PATH="${{ github.workspace }}/examples/examples_list.txt"
52+
export REXM_EXAMPLES_VS2022_SLN_FILE="${{ github.workspace }}/projects/VS2022/raylib.sln"
53+
export EMSDK_PATH="${{ github.workspace }}/emsdk-cache/emsdk-main"
54+
./rexm update
55+
shell: bash
56+
5657
- name: Commit changes to raylib repo
58+
if: github.event_name == 'push' && false
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5761
run: |
58-
#git config user.name "github-actions[bot]"
59-
#git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
60-
#git add -A
61-
#git commit -m "Update examples collection"
62-
#git push
62+
git config --global user.name "github-actions[bot]"
63+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
64+
git add -A
65+
git commit -m "Update examples collection" || echo "git exited with code 1, nothing changed"
66+
git push
67+
shell: bash
6368

6469
- name: Push changes to raylib.com repo
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
if: github.event_name == 'push' && false
6771
run: |
68-
#git config --global user.name "github-actions[bot]"
69-
#git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
70-
#git add examples
71-
#git commit -m "Update web examples"
72-
#git push origin
72+
cd raylib.com
73+
git add -A
74+
git commit -m "Update web examples" || echo "git exited with code 1, nothing changed"
75+
git push origin
76+
shell: bash

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,6 @@ tools/parser/raylib_parser
116116
tools/rexm/rexm.exe
117117
tools/rexm/rexm
118118

119+
# CI
120+
emsdk-cache/
121+
raylib.com/

0 commit comments

Comments
 (0)