Skip to content

Website Deploy

Website Deploy #156

Workflow file for this run

name: Website Deploy
on:
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build-corelib-docs:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.31
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install mdBook
run: cargo install --version ${MDBOOK_VERSION} mdbook
- uses: software-mansion/setup-scarb@v1
- name: Init Scarb to cache corelib
id: scarb-init
run: |
mkdir -p $HOME/pkg
pushd $HOME/pkg
scarb init --no-vcs
echo "CORELIB_PATH=$(scarb metadata --format-version 1 | jq -r '.packages[] | select(.name == "core") | .root')" >> $GITHUB_OUTPUT
env:
SCARB_INIT_TEST_RUNNER: cairo-test
- name: Extract corelib from Scarb cache
run: |
mkdir -p core
cp -r ${{ steps.scarb-init.outputs.CORELIB_PATH }}/* ./core
- name: Generate and build corelib docs
run: |
scarb doc --all-features
pushd target/doc/core
mdbook build
working-directory: ./core
- name: Apply custom highlighting
run: |
curl -o highlight.js https://raw.githubusercontent.com/software-mansion/scarb/main/extensions/scarb-doc/theme/highlight.js
cp highlight.js ./core/target/doc/core/highlight.js
- uses: actions/upload-artifact@v4
with:
name: corelib-docs
path: ./core/target/doc/core/book
build:
runs-on: ubuntu-latest
needs: build-corelib-docs
defaults:
run:
working-directory: ./website
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'release' && 'main' || github.ref }}
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- uses: actions/configure-pages@v5
- run: npm ci
- run: npm run build
- uses: actions/download-artifact@v4
with:
name: corelib-docs
path: website/.vitepress/dist/corelib
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: website/.vitepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4