|
|
@ -0,0 +1,80 @@ |
|
|
|
name: Update examples collection |
|
|
|
|
|
|
|
on: |
|
|
|
workflow_dispatch: |
|
|
|
push: |
|
|
|
paths: |
|
|
|
- 'examples/**' |
|
|
|
- '.github/workflows/examples_update.yml' |
|
|
|
pull_request: |
|
|
|
paths: |
|
|
|
- 'examples/**' |
|
|
|
- '.github/workflows/examples_update.yml' |
|
|
|
|
|
|
|
jobs: |
|
|
|
build: |
|
|
|
runs-on: windows-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/raysan5/raylib.com.git |
|
|
|
shell: cmd |
|
|
|
|
|
|
|
- name: Build and run rexm tool (VS2022 solution) |
|
|
|
# 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: | |
|
|
|
cd tools/rexm/VS2022 |
|
|
|
msbuild.exe rexm.sln /target:rexm /property:Configuration=Release /property:Platform=x64 |
|
|
|
cd ../../.. |
|
|
|
# Set required environment properties to be used by rexm |
|
|
|
set REXM_EXAMPLES_BASE_PATH="examples" |
|
|
|
set REXM_EXAMPLES_WEB_PATH="../raylib.com/examples" |
|
|
|
set REXM_EXAMPLES_TEMPLATE_FILE_PATH="examples/examples_template.c" |
|
|
|
set REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH="examples/examples_template.png" |
|
|
|
set REXM_EXAMPLES_COLLECTION_FILE_PATH="examples/examples_list.txt" |
|
|
|
set REXM_EXAMPLES_VS2022_SLN_FILE="projects/VS2022/raylib.sln" |
|
|
|
# Set emsdk path for Makefile.Web examples building |
|
|
|
set EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-main" |
|
|
|
# Run rexm to update required files |
|
|
|
.\tools\rexm\VS2022\build\rexm\bin\x64\Release\rexm.exe update |
|
|
|
cd ../.. |
|
|
|
shell: cmd |
|
|
|
|
|
|
|
- name: Commit changes to raylib repo |
|
|
|
run: | |
|
|
|
git config user.name "github-actions[bot]" |
|
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
|
|
|
git add -A |
|
|
|
if git diff --cached --quiet; then |
|
|
|
echo "No changes to commit" |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
git commit -m "Update examples collection" |
|
|
|
git push |
|
|
|
|
|
|
|
- name: Push changes to raylib.com 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 examples |
|
|
|
if git diff --cached --quiet; then |
|
|
|
echo "No changes to push" |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
git commit -m "Update web examples" |
|
|
|
git push origin |