Skip to content

Commit

Permalink
fix: automate adding install scripts to the docs (prefix-dev#1302)
Browse files Browse the repository at this point in the history
Triggered by tip from @beenje
  • Loading branch information
ruben-arts authored and wolfv committed May 3, 2024
1 parent 1a1fcbe commit 42c9c8a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions install/docs_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from pathlib import Path
from mkdocs.structure.files import File, Files
from mkdocs.config.defaults import MkDocsConfig

INSTALL_SCRIPTS = [Path(__file__).parent / "install.sh", Path(__file__).parent / "install.ps1"]


def on_files(files: Files, config: MkDocsConfig):
"""Copy the install scripts to the site."""
for script in INSTALL_SCRIPTS:
files.append(
File(
path=script.name,
src_dir=script.parent,
dest_dir=f"{config.site_dir}",
use_directory_urls=config.use_directory_urls,
)
)
return files
2 changes: 2 additions & 0 deletions install/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
https://pixi.sh
.LINK
https://github.com/prefix-dev/pixi
.NOTES
Version: v0.20.1
#>
param (
[string] $PixiVersion = 'latest',
Expand Down
1 change: 1 addition & 0 deletions install/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
# Version: v0.20.1

__wrap__() {

Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ nav:

hooks:
- schema/docs_hooks.py
- install/docs_hooks.py

plugins:
- redirects:
Expand Down
9 changes: 9 additions & 0 deletions tbump.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ search = '^version = "{current_version}"'
[[file]]
src = "docs/advanced/github_actions.md"
search = "pixi-version: v{current_version}"

[[file]]
src = "schema/schema.json"
search = "/pixi.sh/v{current_version}/"

[[file]]
src = "install/install.sh"
search = "Version: v{current_version}"

[[file]]
src = "install/install.ps1"
search = "Version: v{current_version}"

[[field]]
# the name of the field
name = "candidate"
Expand Down

0 comments on commit 42c9c8a

Please sign in to comment.