diff --git a/.github/workflows/update_examples.yml b/.github/workflows/update_examples.yml index 8fb16a2be..6908f0796 100644 --- a/.github/workflows/update_examples.yml +++ b/.github/workflows/update_examples.yml @@ -4,14 +4,18 @@ 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: windows-latest + runs-on: ubuntu-latest steps: - name: Checkout @@ -22,51 +26,51 @@ jobs: with: version: 'latest' actions-cache-folder: 'emsdk-cache' - - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v2 - - - name: Clone raylib.com repo to update files - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Clone raylib.com repo 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) + git clone https://x-access-token:${{ secrets.RAYLIB_DOT_COM_REPO_TOKEN }}@github.com/$GITHUB_REPOSITORY_OWNER/raylib.com.git + 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: | - cd tools/rexm/VS2022 - msbuild.exe rexm.sln /target:rexm /property:Configuration=Release /property:Platform=x64 - cd ${{ github.workspace }}\tools\rexm\VS2022\build\rexm\bin\x64\Release - set REXM_EXAMPLES_BASE_PATH=${{ github.workspace }}\examples - set REXM_EXAMPLES_WEB_PATH=${{ github.workspace }}\..\raylib.com\examples - set REXM_EXAMPLES_TEMPLATE_FILE_PATH=${{ github.workspace }}\examples\examples_template.c - set REXM_EXAMPLES_TEMPLATE_SCREENSHOT_PATH=${{ github.workspace }}\examples\examples_template.png - set REXM_EXAMPLES_COLLECTION_FILE_PATH=${{ github.workspace }}\examples\examples_list.txt - set REXM_EXAMPLES_VS2022_SLN_FILE=${{ github.workspace }}\projects\VS2022\raylib.sln - set EMSDK_PATH=${{ github.workspace }}/emsdk-cache/emsdk-main - dir - rexm.exe build core_basic_window - cd ${{ github.workspace }}\.. - dir - 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 - #git commit -m "Update examples collection" - #git push + 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 + make clean + make PLATFORM=PLATFORM_WEB + cd ../tools/rexm/ + make + 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 + shell: bash - - name: Push changes to raylib.com repo + - name: Commit changes to raylib repo + if: github.event_name == 'push' && false 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 - #git commit -m "Update web examples" - #git push origin + 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: Push changes to raylib.com repo + if: github.event_name == 'push' && false + run: | + cd raylib.com + git add -A + git commit -m "Update web examples" || echo "git exited with code 1, nothing changed" + git push origin + shell: bash diff --git a/.gitignore b/.gitignore index 0d686cd1d..ac4f016e4 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,6 @@ tools/parser/raylib_parser tools/rexm/rexm.exe tools/rexm/rexm +# CI +emsdk-cache/ +raylib.com/