From 221f1c41d683e0443badb942982a5a6e478aaf91 Mon Sep 17 00:00:00 2001 From: Olivier Borderies Date: Tue, 16 May 2023 22:56:06 +0200 Subject: [PATCH 1/5] Add manual build and deploy --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ deploy-ghp.bat | 40 ++++++++++++++++++++++++++++++++++++ deploy-ghp.sh | 32 +++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 deploy-ghp.bat create mode 100644 deploy-ghp.sh diff --git a/README.md b/README.md index f8d0424c4..780f344cf 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,61 @@ 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 +``` + +- git commit and push to your repo: + +```sh +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.batch +``` + +- Visit gh-pages static site: https://github. + ## 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..512d8e870 --- /dev/null +++ b/deploy-ghp.bat @@ -0,0 +1,40 @@ +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.bat +git commit -m "Add deploy script" + +REM git clean -n +git clean -f + +git rm --cached deploy-ghp.bat +git commit -m "Remove deploy script" + +REM delete folders/files +rd /s /q ph_tools +del README.md requirements.txt pyproject.toml setup.py + +REM only files/dir from .\doc will be commited +xcopy /s doc . +copy index.html 404.html + +echo doc > .gitignore +echo build >> .gitignore +echo dist >> .gitignore +echo wip >> .gitignore +echo utils >> .gitignore +echo scripts-* >> .gitignore +echo *.egg-info >> .gitignore + +git add . +git commit -m "Deploy" +git push --set-upstream origin gh-pages + +git checkout main \ No newline at end of file diff --git a/deploy-ghp.sh b/deploy-ghp.sh new file mode 100644 index 000000000..24cac0c75 --- /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" + +# put all repo files/dif in .gitignore +ls -aI .gitignore -I . -I .. > .gitignore + +# only files/dir from ./docs/.vitepress/dist will be commited +cp -r ./dist/* ./ + +git add . +git commit -m "Deploy" +git push --set-upstream origin gh-pages + +git checkout main From 39e0f6f82a32ca9ec212b94183064fb6d5623375 Mon Sep 17 00:00:00 2001 From: Olivier Borderies Date: Tue, 16 May 2023 23:43:53 +0200 Subject: [PATCH 2/5] Fix deploy scripts --- README.md | 3 ++- deploy-ghp.bat | 28 +++++++++------------------- deploy-ghp.sh | 6 +++--- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 780f344cf..49c5dbbbd 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ jupyter lite build --contents content --output-dir dist - 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 @@ -74,7 +75,7 @@ git push -u origin main deploy-ghp.batch ``` -- Visit gh-pages static site: https://github. +- Visit gh-pages static site: `https://[YOURNAME].github.io/[YOURREPO]`. ## Further Information and Updates diff --git a/deploy-ghp.bat b/deploy-ghp.bat index 512d8e870..0d7c3fd02 100644 --- a/deploy-ghp.bat +++ b/deploy-ghp.bat @@ -6,35 +6,25 @@ git branch -D gh-pages git checkout --orphan gh-pages -git rm --cached -rf . +git rm --cached -rf . -git add deploy-ghp.bat +git add deploy-ghp.sh git commit -m "Add deploy script" -REM git clean -n +# git clean -n git clean -f -git rm --cached deploy-ghp.bat +git rm --cached deploy-ghp.sh git commit -m "Remove deploy script" -REM delete folders/files -rd /s /q ph_tools -del README.md requirements.txt pyproject.toml setup.py +REM remove all but deploy script +rm -rf .github content repl .gitignore .jupyterlite.doit.db deploy-ghp.bat README.md requirements.txt -REM only files/dir from .\doc will be commited -xcopy /s doc . -copy index.html 404.html - -echo doc > .gitignore -echo build >> .gitignore -echo dist >> .gitignore -echo wip >> .gitignore -echo utils >> .gitignore -echo scripts-* >> .gitignore -echo *.egg-info >> .gitignore +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 \ No newline at end of file +git checkout main diff --git a/deploy-ghp.sh b/deploy-ghp.sh index 24cac0c75..a2cc7d8be 100644 --- a/deploy-ghp.sh +++ b/deploy-ghp.sh @@ -19,10 +19,10 @@ git clean -f git rm --cached deploy-ghp.sh git commit -m "Remove deploy script" -# put all repo files/dif in .gitignore -ls -aI .gitignore -I . -I .. > .gitignore +# 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 ./docs/.vitepress/dist will be commited +# only files/dir from ./dist will be commited cp -r ./dist/* ./ git add . From 59cfeb6a2ceec33c583cee9e4ec3b527c0ed37d4 Mon Sep 17 00:00:00 2001 From: Olivier Borderies Date: Wed, 17 May 2023 23:48:31 +0200 Subject: [PATCH 3/5] Fix typo --- deploy-ghp.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-ghp.bat b/deploy-ghp.bat index 0d7c3fd02..4ed0e83d2 100644 --- a/deploy-ghp.bat +++ b/deploy-ghp.bat @@ -18,7 +18,7 @@ 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.bat README.md requirements.txt +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/* ./ From 101f226dd3abeb73fabcb89eb752a549a8e847a9 Mon Sep 17 00:00:00 2001 From: Olivier Borderies Date: Thu, 18 May 2023 00:46:56 +0200 Subject: [PATCH 4/5] Add local serve before deploy --- README.md | 74 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 49c5dbbbd..6fe950e53 100644 --- a/README.md +++ b/README.md @@ -27,55 +27,63 @@ This section does the same as the Github Action based automatic build & deploy d - git clone the repo: -```sh -mkdir work-zone # a working dir -cd work-zone + ```sh + mkdir work-zone # a working dir + cd work-zone -git clone https://github.com/jupyterlite/demo.git -cd demo -rm -rf .git -``` + 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 -``` + ```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 + ```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 -``` + jupyter lite build --contents content --output-dir dist + ``` - 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 -``` + ```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 + ``` + +- Serve static site in `./dist` locally: + + ```sh + python -m http.server -d dist 3000 + ``` + + Visit http://localhost:3000 - Deploy static site in `./dist` to GitHub Pages: -```sh -# linux -. ./deploy-ghp.sh + ```sh + # linux + . ./deploy-ghp.sh -# win -deploy-ghp.batch -``` + # win + deploy-ghp.batch + ``` -- Visit gh-pages static site: `https://[YOURNAME].github.io/[YOURREPO]`. + Visit [gh-pages](https://docs.github.com/en/pages) static site: `https://[YOURNAME].github.io/[YOURREPO]`. ## Further Information and Updates From 242980da244bf81e193c10ee9464b57982926d81 Mon Sep 17 00:00:00 2001 From: Olivier Borderies Date: Thu, 18 May 2023 01:36:00 +0200 Subject: [PATCH 5/5] Reorder --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6fe950e53..dbfd18bd9 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,14 @@ This section does the same as the Github Action based automatic build & deploy d 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 @@ -65,14 +73,6 @@ This section does the same as the Github Action based automatic build & deploy d git push -u origin main ``` -- Serve static site in `./dist` locally: - - ```sh - python -m http.server -d dist 3000 - ``` - - Visit http://localhost:3000 - - Deploy static site in `./dist` to GitHub Pages: ```sh @@ -80,7 +80,7 @@ This section does the same as the Github Action based automatic build & deploy d . ./deploy-ghp.sh # win - deploy-ghp.batch + deploy-ghp.bath ``` Visit [gh-pages](https://docs.github.com/en/pages) static site: `https://[YOURNAME].github.io/[YOURREPO]`.