Skip to content

Commit

Permalink
docs: use new docs with mkdocs (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv authored Dec 19, 2023
1 parent fa672b9 commit 475f0a6
Show file tree
Hide file tree
Showing 13 changed files with 9,714 additions and 3,552 deletions.
82 changes: 36 additions & 46 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
pull_request:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
- 'mkdocs.yml'
- 'pixi.*'
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: --html-in-header header.html


# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build-and-deploy:
build:
# Don't run on forks
if: github.repository == 'prefix-dev/rattler-build'
runs-on: ubuntu-latest
steps:
Expand All @@ -32,54 +34,42 @@ jobs:
with:
submodules: recursive

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'


- uses: dtolnay/rust-toolchain@master
- uses: prefix-dev/[email protected]
with:
toolchain: '1.73.0'
pixi-version: v0.10.0
cache: true

- name: Setup Pages
uses: actions/configure-pages@v4
uses: actions/configure-pages@v3

# This does the following:
# - Replaces the docs icon with one that clearly denotes it's not the released package on crates.io
# - Adds a meta tag that forces Google not to index any page on the site.
- name: Pre-docs-build
run: |
echo "<meta name=\"robots\" content=\"noindex\">" > header.html
- uses: Swatinem/rust-cache@v2
- name: Build Documentation
run: cargo doc --workspace --no-deps --all-features
- name: Build Book
run: mdbook build
- name: Build pixi Documentation
run: pixi run build-docs

# This adds the following:
# - A top level redirect to the bevy crate documentation
# - A robots.txt file to forbid any crawling of the site (to defer to the docs.rs site on search engines).
# - A .nojekyll file to disable Jekyll GitHub Pages builds.
# - Adds installation scripts to the pages webserver.
- name: Finalize documentation
run: |
mkdir final_docs
touch final_docs/.nojekyll
echo "<meta http-equiv=\"refresh\" content=\"0; url=rattler/index.html\">" > target/doc/index.html
mkdir -p final_docs/reference
mv target/doc/* final_docs/reference
touch site/.nojekyll
# cp install/{install.sh,install.ps1} site
mv book/* final_docs/
echo "User-Agent: *\nDisallow: /" > final_docs/robots.txt
# https://github.com/actions/upload-pages-artifact#file-permissions
- run: chmod -c -R +rX site/

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'final_docs'
path: "site"

deploy:
runs-on: ubuntu-latest
needs: build
if: github.repository == 'prefix-dev/rattler-build' && github.ref == 'refs/heads/main'
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
with:
toolchain: '1.73.0'
targets: ${{ matrix.target }}

- name: Install musl-gcc
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt install musl-tools
Expand Down
16 changes: 0 additions & 16 deletions docs/SUMMARY.md

This file was deleted.

38 changes: 38 additions & 0 deletions docs/assets/logo_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/available_jinja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Jinja functions that can be used in the recipe

`rattler-build` comes with a couple of useful helpers that can be used in the recipe.

- `${{ compiler('c') }}`
- `${{ pin_subpackage("mypkg", min_pin="x.x", max_pin="x.x.x") }}` creates a pin to another output in the recipe.

<!-- `pin_compatible` (not implemented yet). -->

- `${{ hash }}` this is the variant hash and is useful in the build string computation
- `${{ python | version_to_buildstring }}` converts a version from the variant to a build string (removes `.` and takes only the first two elements of the version).
- default jinja filters are available: `lower`, `upper`, indexing into characters: `https://myurl.com/{{ name[0] }}/{{ name | lower }}_${{ version }}.tar.gz`.
A list of all the builtin filters can be found under: [Link](https://docs.rs/minijinja/latest/minijinja/filters/index.html#functions)
Loading

0 comments on commit 475f0a6

Please sign in to comment.