Skip to content

publish

publish #4

Workflow file for this run

name: publish
on:
release:
types: [published]
permissions:
contents: write
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: robinraju/[email protected]
with:
repository: "mattiasgustavsson/docgen"
latest: true
fileName: "docgen-linux.tar.gz"
- name: build docs
run: |
tar -xzvf docgen-linux.tar.gz
./docgen docs/yarnspin.md docs/yarnspin.html
- name: html to pdf
uses: LukaszLapaj/html-to-pdf-action@master
with:
htmlFile: ./docs/yarnspin.html
outputFile: ./yarnspin.pdf
pdfOptions: '{"format": "A4", "margin": {"top": "10mm", "left": "10mm", "right": "10mm", "bottom": "10mm"}}'
- name: upload artifact
uses: actions/upload-artifact@master
with:
name: yarnspin.pdf
path: ./yarnspin.pdf
publish-windows:
needs: build-docs
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
# this runs vcvarsall for us, so we get the MSVC toolchain in PATH.
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- uses: robinraju/[email protected]
with:
repository: "mattiasgustavsson/dos-like"
tag: "wasm-env"
fileName: "dos-like-wasm-build-env-win.zip"
- uses: actions/download-artifact@master
with:
name: yarnspin.pdf
path: .
- name: install dependencies
run: 7z -y x dos-like-wasm-build-env-win.zip
- name: build yarnspin
run: |
pushd build
rc /nologo yarnspin.rc
popd
cl source\yarnspin.c build\yarnspin.res /nologo /O2 /Ob2 /Oi /Ot /Oy /MT /GL /GF /D "NDEBUG" /Fe:yarnspin.exe /link /INCREMENTAL:NO /OPT:REF /OPT:ICF /LTCG /SUBSYSTEM:CONSOLE
cl source\yarnspin.c build\yarnspin.res /nologo /O2 /Ob2 /Oi /Ot /Oy /MT /GL /GF /D "NDEBUG" /D "YARNSPIN_RUNTIME_ONLY" /Fe:runtime.exe /link /INCREMENTAL:NO /OPT:REF /OPT:ICF /LTCG /SUBSYSTEM:WINDOWS
wasm\node wasm\wajicup.js source/yarnspin.c runtime.wasm
wasm\node wasm\wajicup.js -template build/template.html runtime.wasm runtime.html -no_minify
move runtime.exe build
move runtime.wasm build
move runtime.html build
7z a yarnspin-win.zip yarnspin.exe yarnspin.pdf faces fonts images palettes scripts sound build\runtime.exe build\runtime.wasm build\runtime.html build\template.html build\yarnspin_icon.png
- name: upload artifacts
uses: softprops/action-gh-release@v1
with:
files: yarnspin-win.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-macos:
needs: build-docs
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: robinraju/[email protected]
with:
repository: "mattiasgustavsson/dos-like"
tag: "wasm-env"
fileName: "dos-like-wasm-build-env-win.zip"
- uses: actions/download-artifact@master
with:
name: yarnspin.pdf
path: .
- name: install dependencies
run: |
brew install sdl2 glew llvm binaryen
brew link --force llvm
7z -y x dos-like-wasm-build-env-win.zip
- name: build yarnspin
run: |
clang -o yarnspin -O2 source/yarnspin.c /usr/local/lib/libGLEW.a `sdl2-config --static-libs --cflags` -framework OpenGL -lpthread
chmod a+x yarnspin
clang -o runtime -O2 -DYARNSPIN_RUNTIME_ONLY source/yarnspin.c /usr/local/lib/libGLEW.a `sdl2-config --static-libs --cflags` -framework OpenGL -lpthread
chmod a+x runtime
echo 'clang "$@"' > wasm/clang
chmod a+x wasm/clang
echo 'wasm-ld "$@"' > wasm/wasm-ld
chmod a+x wasm/wasm-ld
echo 'wasm-opt "$@"' > wasm/wasm-opt
chmod a+x wasm/wasm-opt
node wasm/wajicup.js source/yarnspin.c runtime.wasm
node wasm/wajicup.js -template build/template.html runtime.wasm runtime.html -no_minify
mv runtime build
mv runtime.wasm build
mv runtime.html build
tar -czvf yarnspin-mac.tar.gz yarnspin yarnspin.pdf faces fonts images palettes scripts sound build/runtime build/runtime.wasm build/runtime.html build/template.html build/yarnspin_icon.png
- name: upload artifacts
uses: softprops/action-gh-release@v1
with:
files: yarnspin-mac.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-linux:
needs: build-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: robinraju/[email protected]
with:
repository: "libsdl-org/SDL"
tag: "release-2.28.1"
fileName: "SDL2-2.28.1.tar.gz"
- uses: robinraju/[email protected]
with:
repository: "mattiasgustavsson/dos-like"
tag: "wasm-env"
fileName: "dos-like-wasm-build-env-win.zip"
- uses: actions/download-artifact@master
with:
name: yarnspin.pdf
path: .
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq libglew-dev
sudo apt-get install -qq llvm
sudo apt-get install -qq lld
sudo apt-get install -qq binaryen
7z -y x dos-like-wasm-build-env-win.zip
tar -xzvf SDL2-2.28.1.tar.gz
- name: build yarnspin
run: |
cd SDL2-2.28.1
./configure --disable-shared --enable-static --prefix=$PWD/sdl2
make
make install
cd ..
gcc -o yarnspin -O2 source/yarnspin.c /usr/lib/x86_64-linux-gnu/libGLEW.a `$PWD/SDL2-2.28.1/sdl2/bin/sdl2-config --cflags` $PWD/SDL2-2.28.1/sdl2/lib/libSDL2.a -lGL -lm -lpthread
chmod a+x yarnspin
gcc -o runtime -O2 -DYARNSPIN_RUNTIME_ONLY source/yarnspin.c /usr/lib/x86_64-linux-gnu/libGLEW.a `$PWD/SDL2-2.28.1/sdl2/bin/sdl2-config --cflags` $PWD/SDL2-2.28.1/sdl2/lib/libSDL2.a -lGL -lm -lpthread
chmod a+x runtime
clang -cc1 -triple wasm32 -emit-obj -fcolor-diagnostics -Iwasm/ -D__WAJIC__ -isystem./wasm/system/include/libcxx -isystem./wasm/system/lib/libcxx/include -isystem./wasm/system/include/compat -isystem./wasm/system/include -isystem./wasm/system/include/libc -isystem./wasm/system/lib/libc/musl/include -isystem./wasm/system/lib/libc/musl/arch/emscripten -isystem./wasm/system/lib/libc/musl/arch/generic -mconstructor-aliases -fvisibility hidden -fno-threadsafe-statics -fno-common -fgnuc-version=4.2.1 -D__EMSCRIPTEN__ -D_LIBCPP_ABI_VERSION=2 -D_POSIX_C_SOURCE -DNDEBUG -Os -x c -std=c99 -o runtime.o source/yarnspin.c
wasm-ld -strip-all -gc-sections --no-entry -allow-undefined -export=__wasm_call_ctors -export=main -export=__original_main -export=__main_argc_argv -export=__main_void -export=malloc ./wasm/system/system.bc runtime.o -o runtime.wasm
wasm-opt --asyncify runtime.wasm -o runtime.wasm
wasm-opt --legalize-js-interface --low-memory-unused --converge -Os runtime.wasm -o runtime.wasm
node wasm/wajicup.js -template build/template.html runtime.wasm runtime.html -no_minify
mv runtime build
mv runtime.wasm build
mv runtime.html build
tar -czvf yarnspin-linux.tar.gz yarnspin yarnspin.pdf faces fonts images palettes scripts sound build/runtime build/runtime.wasm build/runtime.html build/template.html build/yarnspin_icon.png
- name: upload artifacts
uses: softprops/action-gh-release@v1
with:
files: yarnspin-linux.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cleanup:
needs: [publish-windows,publish-macos,publish-linux]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: yarnspin.pdf