try fix coi-serviceworker on cairo page #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gh-pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # To push a branch | |
pull-requests: write # To create a PR from that branch | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
run: | | |
export emcc="docker run --rm --name pcwa -v $(pwd):/app -w=/app vitovan/pango-cairo-wasm emcc" | |
export pkg_config="docker run --rm --name pcwa -v $(pwd):/app -w=/app vitovan/pango-cairo-wasm pkg-config" | |
export CAIRO_FLAGS="$($pkg_config --libs --cflags glib-2.0, gobject-2.0, cairo, pixman-1, freetype2, fontconfig, cairo, expat, harfbuzz) -O3 -s USE_SDL=2 -s USE_PTHREADS=0 -s ASYNCIFY" | |
$emcc $CAIRO_FLAGS hello-cairo.c -o hello-cairo.html | |
export PANGOCAIRO_FLAGS="$($pkg_config --libs --cflags glib-2.0, gobject-2.0, cairo, pixman-1, freetype2, fontconfig, cairo, expat, harfbuzz, pangocairo) -O3 -s USE_SDL=2 -s EMULATE_FUNCTION_POINTER_CASTS -s PTHREAD_POOL_SIZE=10 -s USE_PTHREADS=1 -s ASYNCIFY" | |
$emcc $PANGOCAIRO_FLAGS --embed-file ./fonts@/usr/share/fonts/ hello-pangocairo.c -o hello-pangocairo.html | |
mkdir web | |
mv hello-pangocairo.html hello-pangocairo.original.html | |
mv *.png web/ | |
mv *.js web/ | |
mv *.wasm web/ | |
mv *.html web/ | |
sed 's|</head>|<script>alert('This one won't work here due to CORS settings of Github Pages, please build and try this locally.');</script></head>|' web/hello-pangocairo.original.html > web/hello-pangocairo.html | |
- name: Deploy GitHub Pages | |
run: | | |
git worktree add gh-pages | |
git config user.name "Deploy from CI" | |
git config user.email "" | |
cd gh-pages | |
# Delete the ref to avoid keeping history. | |
git update-ref -d refs/heads/gh-pages | |
rm -rf * | |
mv ../web/* . | |
git add . | |
git commit -m "Deploy $GITHUB_SHA to gh-pages" | |
git push --force --set-upstream origin gh-pages |