Skip to content

Workflow file for this run

name: Publish GitHub Pages for frender@v2
on:
push:
branches:
- v2
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup rust wasm
run: rustup target add wasm32-unknown-unknown
- name: Install trunk
run: |
set -e
cd /usr/local/bin
wget -qO- https://github.com/thedodd/trunk/releases/download/${VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
chmod +x trunk
env:
VERSION: v0.16.0
- name: Install mdbook
run: |
set -e
cd /usr/local/bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/${VERSION}/mdbook-${VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=.
chmod +x mdbook
env:
VERSION: v0.4.15
- uses: actions/checkout@v3
with:
path: "frender"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build Pages
run: |
set -e
cd "$GITHUB_WORKSPACE/frender"
node scripts/build-examples.js
mdbook build frender-book
mv frender-book/book dist/
- uses: actions/checkout@v3
with:
ref: "gh-pages"
path: "gh-pages"
- name: Publish Pages
run: |
set -e
cd "$GITHUB_WORKSPACE/frender"
rm -rf ../gh-pages/v2/
mv dist ../gh-pages/v2
cd ../gh-pages
# https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
touch .nojekyll
if [[ `git status --porcelain` ]]; then
git config user.name github-actions
git config user.email github-actions@github.com
# Changes
git add .
git commit -m "publish pages"
git push
else
# No changes
echo "Pages not changed"
fi