summaryrefslogtreecommitdiff
path: root/.github/workflows/web-build.yml
blob: 5c2564e6528e8d17aeaac07d280129c2587f4f0b (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
name: Build WebAssembly

on:
  push:
    branches: ["main", "master"]
  pull_request:
    branches: ["main", "master"]
  workflow_dispatch:

jobs:
  build-web:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Install System Dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y imagemagick ffmpeg

      - name: Install Go Minify
        run: |
          go install github.com/tdewolff/minify/v2/cmd/minify@latest
          echo "$(go env GOPATH)/bin" >> $GITHUB_PATH

      - name: Clone Raylib
        run: |
          mkdir -p temp
          git clone --depth 1 https://github.com/raysan5/raylib.git temp/raylib_source

      - name: Setup Emscripten
        uses: mymindstorm/setup-emsdk@v14
        with:
          version: latest
          actions-cache-folder: "emsdk-cache"

      - name: Configure CMake
        run: emcmake cmake -S . -B build-web -DCMAKE_BUILD_TYPE=Release

      - name: Build Project
        run: cmake --build build-web --parallel

      - name: Prepare Distribution Folder
        run: |
          mkdir -p dist

          cp build-web/cirno_day.html dist/index.html
          cp build-web/cirno_day.js dist/
          cp build-web/cirno_day.wasm dist/
          cp build-web/cirno_day.data dist/

          if [ -d "build-web/static" ]; then
            cp -r build-web/static dist/
          fi

      - name: Upload Web Build Artifact
        uses: actions/upload-artifact@v4
        with:
          name: touhou-pride-jam-web
          path: dist/