0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-12-26 22:51:22 -05:00
forgejo-docs/scripts/preview.sh
Michael Jerger 98dac9cb1f Documentation for federated-star (#639)
Preview:

* https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/federation-architecture/
* https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/threat-analysis/
* https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/adr/

Co-authored-by: patdyn <erik.seiert@meissa-gmbh.de>
Co-authored-by: Clemens <clemens.geibel@meissa-gmbh.de.de>
Reviewed-on: https://codeberg.org/forgejo/docs/pulls/639
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
2024-06-29 16:47:25 +00:00

38 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env sh
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 http://localhost:4321/docs/$current_branch/ &
# start the dev server
pnpm run dev