add postproc #469
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: examples | |
on: push | |
jobs: | |
examples: | |
name: build examples | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
example_name: [framework, bare, template, fps, particles, sprites] | |
#yourgame_platform: [desktop, web, android] | |
yourgame_platform: [desktop, web] # ToDo: fix android | |
steps: | |
- uses: actions/checkout@v4 | |
- name: build docker image (desktop) | |
run: docker build -t yourgame --build-arg NO_DOCS="true" --build-arg NO_EMSDK="true" --build-arg NO_ANDROID="true" . | |
if: startsWith(matrix.yourgame_platform, 'desktop') | |
- name: build docker image (web) | |
run: docker build -t yourgame --build-arg NO_DOCS="true" --build-arg NO_ANDROID="true" . | |
if: startsWith(matrix.yourgame_platform, 'web') | |
- name: build docker image (android) | |
run: docker build -t yourgame --build-arg NO_DOCS="true" --build-arg NO_EMSDK="true" . | |
if: startsWith(matrix.yourgame_platform, 'android') | |
- name: initialize | |
run: docker run --rm -v $(pwd):/code yourgame /bin/bash -c "cd examples/${{ matrix.example_name }} && ./init.bash" | |
- name: build | |
run: docker run --rm -v $(pwd):/code yourgame /bin/bash -c "cd examples/${{ matrix.example_name }}/build && ./build_${{ matrix.yourgame_platform }}_release.bash" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.example_name }}-${{ matrix.yourgame_platform }} | |
path: examples/${{ matrix.example_name }}/build/_deploy/* | |
examples_windows: | |
name: build examples windows | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
example_name: [framework, bare, template, fps, particles, sprites] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: install python deps | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r init/requirements.txt | |
- name: initialize | |
run: | | |
cd examples/${{ matrix.example_name }} | |
init.cmd | |
shell: cmd | |
- name: configure/build (win32) | |
run: | | |
cd examples/${{ matrix.example_name }}/build | |
build_desktop_release_win32.cmd | |
shell: cmd | |
- name: configure/build (win64) | |
run: | | |
cd examples/${{ matrix.example_name }}/build | |
build_desktop_release_win64.cmd | |
shell: cmd | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.example_name }}-windows | |
path: examples/${{ matrix.example_name }}/build/_deploy/* | |
deploy: | |
name: deploy examples | |
runs-on: ubuntu-latest | |
needs: examples | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "refs/heads/gh-pages" | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-web" | |
path: ./ | |
merge-multiple: true | |
- name: unzip web examples | |
run: | | |
for filename in ./*Emscripten.zip | |
do | |
# Get project name (match group \1) from zip file ("project-version-Emscripten.zip") | |
projname=$(echo $filename | sed -E 's/.*\/(.+)-(.+)-(.+)\.zip/\1/') | |
mkdir -p yg_examples/$projname | |
unzip $filename -d yg_examples/$projname | |
done | |
- name: deploy to gh-pages | |
run: | | |
git config --global user.name ${{ github.actor }} | |
git config --global user.email ${{ github.actor }}@users.noreply.github.com | |
git add yg_examples | |
git status | |
git commit --allow-empty -m "YourGameLib automatic web example deployment" | |
git push origin gh-pages |