aboutsummaryrefslogtreecommitdiff
path: root/deps/raylib/.github/workflows/webassembly.yml
blob: c3a392215560a1b24b6526b10dbd5cc00d83207a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: WebAssembly

on:
  workflow_dispatch:
  push:
    paths:
      - 'src/**'
      - 'examples/**'
      - '.github/workflows/webassembly.yml'
  pull_request:
    paths:
      - 'src/**'
      - 'examples/**'
      - '.github/workflows/webassembly.yml'
  release:
    types: [published]

jobs:
  build:
    runs-on: windows-latest
    
    env:
      RELEASE_NAME: raylib-dev_webassembly
    
    steps:
    - name: Checkout
      uses: actions/checkout@master
  
    - name: Setup emsdk
      uses: mymindstorm/setup-emsdk@v14
      with:
        version: 3.1.71
        actions-cache-folder: 'emsdk-cache'
        
    - name: Setup Release Version
      run: |
        echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_webassembly" >> $GITHUB_ENV
      shell: bash
      if: github.event_name == 'release' && github.event.action == 'published'

    - name: Setup Environment
      run: | 
        mkdir build
        cd build
        mkdir ${{ env.RELEASE_NAME }}
        cd ${{ env.RELEASE_NAME }}
        mkdir include
        mkdir lib
        cd ../..
   
    - name: Build Library
      run: |
        cd src
        emcc -v
        make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-main" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
        cd ..
  
    - name: Generate Artifacts
      run: |
        copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
        copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
        copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
        copy /Y .\CHANGELOG .\build/${{ env.RELEASE_NAME }}\CHANGELOG
        copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
        copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
        cd build
        7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
        dir
      shell: cmd
        
    - name: Upload Artifacts
      uses: actions/upload-artifact@v4
      with:
        name: ${{ env.RELEASE_NAME }}.zip
        path: ./build/${{ env.RELEASE_NAME }}.zip
        
    - name: Upload Artifact to Release
      uses: softprops/action-gh-release@v1
      with:
        files: ./build/${{ env.RELEASE_NAME }}.zip
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      if: github.event_name == 'release' && github.event.action == 'published'