shithub: moonfish

ref: cb18a32517a4233240f151a14052977235556169
dir: /.build.yml/

View raw version
# moonfish's license: 0BSD
# copyright 2025 zamfofex

image: alpine/latest

secrets:
- 72a028fc-f8df-43d3-a315-305d80720e45

packages:
- build-base
- libressl-dev
- curl
- cjson-dev
- xz
- md4c

tasks:

- build: |
    cd moonfish
    make CC=gcc LDFLAGS=-static moonfish lichess chat perft
    strip moonfish lichess chat
    scripts/minify.sh

- check: |
    sudo rc-service devfs start
    cd moonfish
    make check

- index: |
    cd moonfish
    {
        cat index.html
        echo '<main><section><h2>about moonfish</h2>'
        md2html README.md | sed -e '1,/<h1>/d' -e 's,<h2>,</section><section><h2>,g'
        echo '</section></main>'
    } > index-out.html

- deploy: |
    set +x
    
    if test "x$GIT_REF" = x || ! test -f neocities-token.txt
    then exit
    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"/moonfish.sh=@moonfish.sh \
      -F "$root"/lichess=@lichess \
      -F "$root"/chat=@chat \
      -F "$root"/index.html=@index-out.html \
      https://neocities.org/api/upload