Skip to content

CNAME

CNAME #51

Workflow file for this run

name: ci
# runs on every push to any branch
on:
push:
branches:
- '*'
jobs:
build:
name: Build
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
# - name: Log in to registry
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
# cache 'upstream' and 'demo/node_modules' folders
# - uses: actions/cache@v2
# with:
# path: |
# upstream
# demo/node_modules
# build/emsdk_cache
# key: ${{ runner.os }}-${{ hashFiles('build/emsdk_cache/sanity.txt') }}-${{ hashFiles('demo/package-lock.json') }}
# restore-keys: ${{ runner.os }}-upstream-
- name: Build
run: |
./build-with-docker.sh
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Check branch and file
env:
GITHUB_REF: ${{ github.ref }}
run: |
if [ "$GITHUB_REF" = "refs/heads/master" ] && [ -e "build/demo/index.html" ]; then
export RUN_PUBLISH=true
else
export RUN_PUBLISH=false
fi
- name: Copy CNAME
run: cp CNAME build/demo/CNAME
# deploy build/demo to gh-pages
- name: Publish demo to gh-pages
uses: peaceiris/actions-gh-pages@v3
# runs only on master and if the file build/demo/index.html exists
if: env.RUN_PUBLISH == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/demo
publish_branch: gh-pages
force_orphan: true
- name: Zip artifact for deployment
run: zip build.zip ./build/* -r
- uses: actions/upload-artifact@v3
with:
name: dist
path: ./build.zip
retention-days: 1