You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.3 KiB

10 months ago
10 months ago
  1. name: WebAssembly
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - 'src/**'
  7. - 'examples/**'
  8. - '.github/workflows/webassembly.yml'
  9. pull_request:
  10. paths:
  11. - 'src/**'
  12. - 'examples/**'
  13. - '.github/workflows/webassembly.yml'
  14. release:
  15. types: [published]
  16. jobs:
  17. build:
  18. runs-on: windows-latest
  19. env:
  20. RELEASE_NAME: raylib-dev_webassembly
  21. steps:
  22. - name: Checkout
  23. uses: actions/checkout@master
  24. - name: Setup emsdk
  25. uses: mymindstorm/setup-emsdk@v14
  26. with:
  27. version: 3.1.64
  28. actions-cache-folder: 'emsdk-cache'
  29. - name: Setup Release Version
  30. run: |
  31. echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_webassembly" >> $GITHUB_ENV
  32. shell: bash
  33. if: github.event_name == 'release' && github.event.action == 'published'
  34. - name: Setup Environment
  35. run: |
  36. mkdir build
  37. cd build
  38. mkdir ${{ env.RELEASE_NAME }}
  39. cd ${{ env.RELEASE_NAME }}
  40. mkdir include
  41. mkdir lib
  42. cd ../..
  43. - name: Build Library
  44. run: |
  45. cd src
  46. emcc -v
  47. make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-main" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
  48. cd ..
  49. - name: Generate Artifacts
  50. run: |
  51. copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
  52. copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
  53. copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
  54. copy /Y .\CHANGELOG .\build/${{ env.RELEASE_NAME }}\CHANGELOG
  55. copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
  56. copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
  57. cd build
  58. 7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
  59. dir
  60. shell: cmd
  61. - name: Upload Artifacts
  62. uses: actions/upload-artifact@v4
  63. with:
  64. name: ${{ env.RELEASE_NAME }}.zip
  65. path: ./build/${{ env.RELEASE_NAME }}.zip
  66. - name: Upload Artifact to Release
  67. uses: softprops/action-gh-release@v1
  68. with:
  69. files: ./build/${{ env.RELEASE_NAME }}.zip
  70. env:
  71. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  72. if: github.event_name == 'release' && github.event.action == 'published'