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.

74 lines
2.1 KiB

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