name: Build and deploy the documentation on: push: branches: [ main ] pull_request: branches: [ main ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always CARGO_NET_GIT_FETCH_WITH_CLI: "true" jobs: build: name: Build the documentation runs-on: ubuntu-latest steps: - name: Checkout the code uses: actions/checkout@v3.5.3 - name: Install Rust toolchain run: | rustup toolchain install stable rustup default stable - name: Setup Rust cache uses: Swatinem/rust-cache@v2.4.0 - name: Setup mdBook uses: peaceiris/actions-mdbook@v1.2.0 with: mdbook-version: '0.4.25' - name: Install Node uses: actions/setup-node@v3.6.0 with: node-version: 18 cache: 'npm' cache-dependency-path: frontend/package-lock.json - name: Install Node dependencies working-directory: ./frontend run: npm ci - name: Build the documentation run: mdbook build - name: Build rustdoc env: # This is required to be able to use the unstable `-Zrustdoc-map` flag RUSTC_BOOTSTRAP: "1" run: cargo doc -Zrustdoc-map --workspace --lib --no-deps - name: Build storybook working-directory: ./frontend run: npx storybook build -o ../target/book/storybook - name: Move the Rust documentation within the mdBook run: mv target/doc target/book/rustdoc - name: Upload GitHub Pages artifacts uses: actions/upload-pages-artifact@v1.0.9 with: path: target/book/ deploy: name: Deploy the documentation on GitHub Pages runs-on: ubuntu-latest needs: build if: github.ref == 'refs/heads/main' permissions: pages: write id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2.0.2