diff --git a/README.md b/README.md index f8d0424c4..dbfd18bd9 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,70 @@ JupyterLite is being tested against modern web browsers: Check out the guide on the JupyterLite documentation: https://jupyterlite.readthedocs.io/en/latest/quickstart/deploy.html +## Manual build and deploy to GitHub Pages + +This section does the same as the Github Action based automatic build & deploy described in the previous one, but offers a step by step approach which possibly offers a better learning experience. + +- git clone the repo: + + ```sh + mkdir work-zone # a working dir + cd work-zone + + git clone https://github.com/jupyterlite/demo.git + cd demo + rm -rf .git + ``` + +- Create a dedicated conda/mamba env: + + ```sh + conda create -n lite-demo python=3.10 -y + conda activate lite-demo + pip install -r requirements.txt + ``` + +- Build jupyterlite static site: + + ```sh + # rm to start from clean sheet + rm ./.jupyterlite.doit.db + rm -rf ./dist + rm -rf ./lite/.cache + + jupyter lite build --contents content --output-dir dist + ``` + +- Serve static site in `./dist` locally: + + ```sh + python -m http.server -d dist 3000 + ``` + + Visit http://localhost:3000 + +- git commit and push to your repo: + + ```sh + git init + git add . && git commit -m "Init" + git remote add origin https://github.com/[YOURNAME]/jupyterlite-demo.git + git branch -M main + git push -u origin main + ``` + +- Deploy static site in `./dist` to GitHub Pages: + + ```sh + # linux + . ./deploy-ghp.sh + + # win + deploy-ghp.bath + ``` + + Visit [gh-pages](https://docs.github.com/en/pages) static site: `https://[YOURNAME].github.io/[YOURREPO]`. + ## Further Information and Updates For more info, keep an eye on the JupyterLite documentation: diff --git a/deploy-ghp.bat b/deploy-ghp.bat new file mode 100644 index 000000000..4ed0e83d2 --- /dev/null +++ b/deploy-ghp.bat @@ -0,0 +1,30 @@ +REM make sure git is clear: +REM git status --porcelain + +git push origin --delete gh-pages +git branch -D gh-pages + +git checkout --orphan gh-pages + +git rm --cached -rf . + +git add deploy-ghp.sh +git commit -m "Add deploy script" + +# git clean -n +git clean -f + +git rm --cached deploy-ghp.sh +git commit -m "Remove deploy script" + +REM remove all but deploy script +rm -rf .github content repl .gitignore .jupyterlite.doit.db deploy-ghp.sh README.md requirements.txt + +REM only files/dir from ./dist will be commited +cp -r ./dist/* ./ + +git add . +git commit -m "Deploy" +git push --set-upstream origin gh-pages + +git checkout main diff --git a/deploy-ghp.sh b/deploy-ghp.sh new file mode 100644 index 000000000..a2cc7d8be --- /dev/null +++ b/deploy-ghp.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# make sure git is clear: +# git status --porcelain + +git push origin --delete gh-pages +git branch -D gh-pages + +git checkout --orphan gh-pages + +git rm --cached -rf . + +git add deploy-ghp.sh +git commit -m "Add deploy script" + +# git clean -n +git clean -f + +git rm --cached deploy-ghp.sh +git commit -m "Remove deploy script" + +# remove all but deploy script +rm -rf .github content repl .gitignore .jupyterlite.doit.db deploy-ghp.bat README.md requirements.txt + +# only files/dir from ./dist will be commited +cp -r ./dist/* ./ + +git add . +git commit -m "Deploy" +git push --set-upstream origin gh-pages + +git checkout main