diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bfcaa5e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build CI + +on: + push: + pull_request: + release: + types: [published] + check_suite: + types: [rerequested] + +jobs: + test: + runs-on: ubuntu-18.04 + container: debian:buster + + steps: + - name: install dependencies + run: | + apt-get update + apt-get --no-install-recommends -y install build-essential git + + - name: checkout + uses: actions/checkout@v2 + + - name: build + run: | + docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk ./build.sh + + - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + name: publish + run: | + git branch -D gh-pages || true + python3 import.py | git fast-import --date-format=now + git config user.email "jepler@gmail.com" + git config user.name "Jeff Epler (github actions)" + git remote set-url --push origin https://jepler:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + + - uses: actions/upload-artifact@v2 + with: + name: Web pages + path: output/ diff --git a/.gitignore b/.gitignore index 54461f5..1f57b97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -/index.html -/index.js -/index.was* +/output diff --git a/build.sh b/build.sh index a2ac83c..d6efe9a 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,4 @@ #!/bin/sh -EMCC_DEBUG=1 emcc -g4 -Wall -Werror -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1 -s ASSERTIONS=2 -DASSERTIONS=2 -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS="['ccall']" -DPACKAGE_STRING=\"bdftopcf\" -I . *.c -o index.html --shell-file shell.html +mkdir output + +emcc -Wall -Werror -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1 -s ASSERTIONS=2 -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS="['ccall']" -DPACKAGE_STRING=\"bdftopcf\" -I . *.c -o output/index.html --shell-file shell.html diff --git a/import.py b/import.py new file mode 100755 index 0000000..09ecb73 --- /dev/null +++ b/import.py @@ -0,0 +1,30 @@ +#!/usr/bin/python3 +import argparse +import glob +import os +import subprocess +import sys + + +parser = argparse.ArgumentParser() +parser.add_argument("branch", default="gh-pages", nargs="?") +args = parser.parse_args() + +version = subprocess.getoutput("git describe --always") + +fd = os.fdopen(sys.stdout.fileno(), 'wb') + +fd.write(b"commit refs/heads/" + args.branch.encode('utf-8') + b"\n") +fd.write(b"committer Doc Man now" + b"\n") +fd.write(b"data <