WebAssembly #38
Workflow file for this run
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: WebAssembly | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
PROJECT_NAME: ${{ github.event.repository.name }} | |
PROJECT_BUILD_PATH: ${{ github.event.repository.name }}\\src | |
PROJECT_RELEASE_PATH: ${{ github.event.repository.name }}_dev_wasm | |
PROJECT_SOURCES: ${{ github.event.repository.name }}.c | |
RAYLIB_CONFIG_FLAGS: "'-DSUPPORT_MODULE_RSHAPES -DSUPPORT_MODULE_RTEXTURES -DSUPPORT_MODULE_RTEXT -DSUPPORT_MODULE_RAUDIO -DSUPPORT_EVENTS_WAITING -DSUPPORT_COMPRESSION_API -DSUPPORT_QUADS_DRAW_MODE -DSUPPORT_IMAGE_MANIPULATION -DSUPPORT_DEFAULT_FONT -DSUPPORT_TEXT_MANIPULATION -DSUPPORT_FILEFORMAT_WAV -DSUPPORT_FILEFORMAT_QOA -DSUPPORT_STANDARD_FILEIO -DSUPPORT_TRACELOG'" | |
BUILD_WEB_SHELL: minshell.html | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@master | |
with: | |
path: ${{ env.PROJECT_NAME }} | |
- name: Checkout raylib repo | |
uses: actions/checkout@v4 | |
with: | |
repository: raysan5/raylib | |
path: raylib | |
- name: Setup emsdk | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: 3.1.54 | |
actions-cache-folder: 'emsdk-cache' | |
- name: Setup Release Paths | |
run: | | |
echo "PROJECT_RELEASE_PATH=${{ env.PROJECT_NAME }}_v${{ github.event.release.tag_name }}_wasm" >> $GITHUB_ENV | |
shell: bash | |
if: github.event_name == 'release' && github.event.action == 'published' | |
- name: Setup Environment | |
run: | | |
mkdir ${{ env.PROJECT_RELEASE_PATH }} | |
dir | |
- name: Build raylib Library | |
run: | | |
cd raylib/src | |
emcc -v | |
make PLATFORM=PLATFORM_WEB RAYLIB_BUILD_MODE=RELEASE RAYLIB_LIBTYPE=STATIC EMSDK_PATH="D:/a/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}/emsdk-cache/emsdk-main" RAYLIB_CONFIG_FLAGS=${{ env.RAYLIB_CONFIG_FLAGS }} RAYLIB_PROJECT_RELEASE_PATH=. -B | |
- name: Build Product | |
run: | | |
cd ${{ env.PROJECT_NAME }}/src | |
make PLATFORM=PLATFORM_WEB BUILD_MODE=RELEASE EMSDK_PATH="D:/a/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}/emsdk-cache/emsdk-main" PROJECT_SOURCE_FILES=${{ env.PROJECT_SOURCES }} PROJECT_BUILD_PATH=. RAYLIB_PATH=../../raylib -B | |
- name: Generate Artifacts | |
run: | | |
dir ${{ env.PROJECT_BUILD_PATH }} | |
copy /Y ${{ env.PROJECT_BUILD_PATH }}\${{ env.PROJECT_NAME }}.wasm ${{ env.PROJECT_RELEASE_PATH }}\${{ env.PROJECT_NAME }}.wasm | |
copy /Y ${{ env.PROJECT_BUILD_PATH }}\${{ env.PROJECT_NAME }}.js ${{ env.PROJECT_RELEASE_PATH }}\${{ env.PROJECT_NAME }}.js | |
copy /Y ${{ env.PROJECT_BUILD_PATH }}\${{ env.PROJECT_NAME }}.html ${{ env.PROJECT_RELEASE_PATH }}\index.html | |
copy /Y ${{ env.PROJECT_NAME }}\README.md ${{ env.PROJECT_RELEASE_PATH }}\README.md | |
copy /Y ${{ env.PROJECT_NAME }}\LICENSE ${{ env.PROJECT_RELEASE_PATH }}\LICENSE | |
dir ${{ env.PROJECT_RELEASE_PATH }} | |
7z a -tzip -r .\${{ env.PROJECT_RELEASE_PATH }}.zip .\${{ env.PROJECT_RELEASE_PATH }}\* | |
shell: cmd | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_RELEASE_PATH }}.zip | |
path: ./${{ env.PROJECT_RELEASE_PATH }}.zip | |
- name: Upload Artifact to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.PROJECT_RELEASE_PATH }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'release' && github.event.action == 'published' |