shithub: moonfish

ref: a03b6067b6a3064f49b7f99b60bec83129fb4884
dir: /.build.yml/

View raw version
# moonfish is licensed under the AGPL (v3 or later)
# copyright 2023, 2024 zamfofex

image: alpine/latest
secrets:
  - 72a028fc-f8df-43d3-a315-305d80720e45
packages:
  - build-base
  - libressl-dev
  - xz
  - mingw-w64-gcc
  - curl
  - cjson-dev
  - wasi-sdk
  - clang
  - lld
  - binaryen
tasks:
  - build: |
      cd moonfish
      make LDFLAGS=-static
      make LDFLAGS=-static CC=x86_64-w64-mingw32-gcc moonfish.exe
      make LDFLAGS=-static CC='clang --target=wasm32-wasi' CPPFLAGS='-Dmoonfish_no_threads' moonfish.wasm
      shell=bash ./minify.sh
  - strip: |
      cd moonfish
      strip --strip-all moonfish play lichess analyse battle ribbon chat book
      wasm-opt -O4 -o moonfish.wasm moonfish.wasm
  - deploy: |
      set +x
      if test "x$GIT_REF" = x || ! test -f neocities-token.txt
      then exit 0
      fi
      
      if test "$GIT_REF" = refs/heads/main
      then root=
      else root="${GIT_REF#refs/*/}"
      fi
      
      cd moonfish
      curl -fsSL --oauth2-bearer "$(cat ~/neocities-token.txt)" \
        -F "$root"/moonfish=@moonfish \
        -F "$root"/play=@play \
        -F "$root"/lichess=@lichess \
        -F "$root"/analyse=@analyse \
        -F "$root"/battle=@battle \
        -F "$root"/ribbon=@ribbon \
        -F "$root"/chat=@chat \
        -F "$root"/moonfish.sh=@moonfish.sh \
        -F "$root"/moonfish.exe=@moonfish.exe \
        -F "$root"/moonfish.wasm=@moonfish.wasm \
        -F "$root"/book=@book \
        -F "$root"/book.txt=@book.txt \
        https://neocities.org/api/upload
artifacts:
  - moonfish/moonfish
  - moonfish/moonfish.sh
  - moonfish/moonfish.exe
  - moonfish/moonfish.wasm
  - moonfish/play
  - moonfish/lichess
  - moonfish/analyse
  - moonfish/book