Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add mike to the documentation and update looks #809

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 76 additions & 37 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,33 @@ on:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- "docs/**"
- "mkdocs.yml"
tags:
- v**
pull_request:
branches:
- main
paths:
- 'docs/**'
- 'install/**'
- '.github/workflows/docs.yml'
- 'mkdocs.yml'
- 'pixi.*'
- "docs/**"
- ".github/workflows/docs.yml"
- "mkdocs.yml"
- "pixi.*"
workflow_dispatch:

inputs:
tag:
description: "Tag to deploy"
required: true
default: "v0.0.0"

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

jobs:
build:
# Don't run on forks
if: github.repository == 'prefix-dev/pixi'
build-docs:
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -40,37 +44,72 @@ jobs:
pixi-version: v0.13.0
cache: true

- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build docs for test
run: |
pixi run build-docs

- name: Build pixi Documentation
run: pixi run build-docs
docs-release:
# Don't run on forks
if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' && startsWith(github.event.inputs.tag, 'v')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# fetch everything so we can checkout the tag
fetch-depth: 0
submodules: recursive

# This adds the following:
# - A .nojekyll file to disable Jekyll GitHub Pages builds.
# - Adds installation scripts to the pages webserver.
- name: Finalize documentation
# check out tag if workflow_dispatch
- name: Checkout tag
if: github.event_name == 'workflow_dispatch'
run: |
touch site/.nojekyll
cp install/{install.sh,install.ps1} site

# https://github.com/actions/upload-pages-artifact#file-permissions
- run: chmod -c -R +rX site/
git checkout tags/${{ github.event.inputs.tag }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- uses: prefix-dev/setup-pixi@v0.5.1
with:
path: "site"
pixi-version: v0.13.0
cache: true

- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Extract tag name
if: github.event_name != 'workflow_dispatch'
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

deploy:
- name: Tag from workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: echo "RELEASE_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV

- name: Deploy with mike 🚀
run: |
pixi run mike deploy --push --update-aliases $RELEASE_VERSION latest

docs-dev:
# Don't run on forks
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' && !startsWith(github.event.inputs.tag, 'v')
runs-on: ubuntu-latest
needs: build
if: github.repository == 'prefix-dev/pixi' && 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@v4
- name: Checkout repository
uses: actions/checkout@v4
with:
# fetch everything so we can checkout the tag
fetch-depth: 0
submodules: recursive

- uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: v0.13.0
cache: true

- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Deploy with mike 🚀
run: |
pixi run deploy-dev
52 changes: 43 additions & 9 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,62 @@
font-family: 'Dosis', sans-serif;
}

[data-md-color-primary=prefix] {
--md-primary-fg-color: #F9C405;
--md-primary-fg-color--light: #ffee57;
--md-primary-fg-color--dark: #F9C405;
--md-primary-bg-color: #000000de;
--md-primary-bg-color--light: #0000008a
}

.md-header__topic:first-child {
font-weight: normal;
[data-md-color-accent=prefix] {
--md-accent-fg-color: #fa0;
--md-accent-fg-color--transparent: #ffaa001a;
--md-accent-bg-color: #000000de;
--md-accent-bg-color--light: #0000008a
}


[data-md-color-primary=prefix-light] {
--md-primary-fg-color: #000000de;
--md-primary-fg-color--light: #ffee57;
--md-primary-fg-color--dark: #F9C405;
--md-primary-bg-color: #F9C405;
--md-primary-bg-color--light: #F9C405;
}

[data-md-color-accent=prefix-light] {
--md-accent-fg-color: #2e2400;
--md-accent-fg-color--transparent: #ffaa001a;
--md-accent-bg-color: #000000de;
--md-accent-bg-color--light: #0000008a
}

.md-typeset *:not(pre) > code {
/* Dimmed 30% of the main yellow color (ffec3d)*/
color: #b3a52b;
.md-nav__item .md-nav__link--active, .md-nav__item .md-nav__link--active code {
color: var(--md-accent-fg-color);
font-weight: bold;
}

.md-header__topic:first-child {
font-weight: normal;
}

.md-typeset h1 {
color: #ffec3d;
color: var(--md-accent-fg-color);
}
.md-typeset h1, .md-typeset h2, .md-typeset h3, .md-typeset h4, .md-typeset h5, .md-typeset h6 {
font-family: 'Dosis', sans-serif;
font-weight: 500;
color: #ffec3d;
color: var(--md-accent-fg-color);
}

.md-typeset p {
/* kerning */
text-rendering: optimizeLegibility;
}


:root > * {
--md-code-hl-string-color: #ffec3d;
--md-code-hl-string-color: var(--md-accent-fg-color);
}

.md-header__button.md-logo {
Expand All @@ -53,3 +82,8 @@
.md-footer-meta__item--prefix-logo img {
height: 100%;
}

table code {
white-space: nowrap;
word-break: keep-all;
}
41 changes: 38 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,29 @@ theme:
code: JetBrains Mono

palette:
primary: yellow
accent: yellow
scheme: slate
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode

# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: prefix-light
accent: prefix-light
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: prefix
accent: prefix
toggle:
icon: material/brightness-4
name: Switch to system preference

icon:
edit: material/pencil
Expand All @@ -24,6 +44,7 @@ theme:
- content.tabs.link
- content.code.copy
- content.action.edit
- content.code.annotate
# - content.code.select Sponsor only
- navigation.instant
- navigation.instant.progress
Expand All @@ -40,7 +61,10 @@ edit_uri: edit/main/docs/

markdown_extensions:
- admonition
- def_list
- footnotes
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
Expand All @@ -67,6 +91,8 @@ extra:
link: https://www.linkedin.com/company/prefix-dev
- icon: fontawesome/brands/github
link: https://github.com/prefix-dev
version:
provider: mike


nav:
Expand Down Expand Up @@ -95,3 +121,12 @@ nav:
plugins:
- search
- social
- mike:
# These fields are all optional; the defaults are as below...
# alias_type: symlink
# redirect_template: null
# deploy_prefix: ''
# canonical_version: null
# version_selector: true
# css_dir: css
# javascript_dir: js
Loading
Loading