mirror of
https://codeberg.org/forgejo/docs.git
synced 2025-02-01 03:35:03 -05:00
2bb951215c
Preview: https://forgejo.codeberg.page/@docs_pull_998/docs/next/admin/runner-installation/#nixos Fixes #903. As described in that issue, the Nix package has been renamed upstream, as well as that the mentioned service module does not exist in reality. I reworked that section to bring everything up-to-date. The mentioned labels pre-population does not apply to Forgejo, at least. I have also added a small example as reference. Further, I included a small change to `scripts/preview.sh`, to detect the actual URL open command - on Linux, `xdg-open` is normally the canonical one. Reviewed-on: https://codeberg.org/forgejo/docs/pulls/998 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Christoph Heiss <christoph@c8h4.io> Co-committed-by: Christoph Heiss <christoph@c8h4.io>
44 lines
1.2 KiB
Bash
Executable file
44 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
if hash xdg-open 2>/dev/null; then
|
|
open_cmd=xdg-open
|
|
else
|
|
open_cmd=open
|
|
fi
|
|
|
|
current_branch=$(git branch --show-current)
|
|
repo_path=$(pwd)
|
|
|
|
# Generate mermaid images
|
|
./scripts/mermaid_image_generate.sh
|
|
|
|
# Clone the website repo, or make sure the current clone is up to date
|
|
if [ ! -e "./.preview" ];then
|
|
git clone https://codeberg.org/forgejo/website.git .preview
|
|
cd .preview
|
|
else
|
|
cd .preview
|
|
git checkout main
|
|
git pull
|
|
fi
|
|
|
|
# make sure the docs content of the website is up to date
|
|
git submodule update --remote
|
|
|
|
# install the website dependencies
|
|
pnpm install
|
|
|
|
# symlink the current docs branch from the website content repo
|
|
rm -rf ./src/content/docs/$current_branch
|
|
mkdir -p $(dirname ./src/content/docs/$current_branch) # in case of branch names with slashes
|
|
ln -s $repo_path/docs/ ./src/content/docs/$current_branch
|
|
|
|
rm -rf ./public/images/$current_branch
|
|
mkdir -p $(dirname ./src/content/images/$current_branch) # in case of branch names with slashes
|
|
ln -s $repo_path/images/ ./public/images/$current_branch
|
|
|
|
# once the dev server is running, open the current docs branch in the browser
|
|
sleep 3 && $open_cmd http://localhost:4321/docs/$current_branch/ &
|
|
|
|
# start the dev server
|
|
pnpm run dev
|