83 lines
2.6 KiB
YAML
83 lines
2.6 KiB
YAML
# The documentation site on GitHub Pages: the book (docs/book) at /solvecraft/ and the web app
|
|
# at /solvecraft/app/. Needs Settings → Pages → Source = GitHub Actions; skipped while the
|
|
# repository is private.
|
|
name: Pages
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_tag:
|
|
description: "Published release for Flatpak (empty: latest stable release)"
|
|
type: string
|
|
required: false
|
|
default: ""
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
MDBOOK_VERSION: v0.5.4
|
|
TRUNK_VERSION: v0.21.14
|
|
|
|
jobs:
|
|
build:
|
|
if: ${{ !github.event.repository.private }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
- name: Install mdbook and trunk
|
|
run: |
|
|
mkdir -p "$HOME/.local/bin"
|
|
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz -C "$HOME/.local/bin"
|
|
curl -sSL "https://github.com/trunk-rs/trunk/releases/download/${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz" | tar -xz -C "$HOME/.local/bin"
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
- name: Build the book
|
|
run: cargo xtask book
|
|
- name: Build the web app
|
|
working-directory: apps/solvecraft-web
|
|
run: trunk build --release --public-url /solvecraft/app/
|
|
- name: Assemble the site
|
|
run: |
|
|
mkdir -p site
|
|
cp -r target/book/. site/
|
|
cp -r dist/web site/app
|
|
- uses: actions/configure-pages@v5
|
|
id: pages
|
|
- name: Install Flatpak repository tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends flatpak ostree
|
|
- name: Include the published Flatpak repository
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
RELEASE_TAG: ${{ inputs.release_tag || '' }}
|
|
PAGES_BASE_URL: ${{ steps.pages.outputs.base_url }}
|
|
run: bash packaging/flatpak-site.sh site
|
|
- uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: site
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- id: deployment
|
|
uses: actions/deploy-pages@v4
|