-
Notifications
You must be signed in to change notification settings - Fork 0
/
jbb_https.sh
executable file
·64 lines (48 loc) · 1.99 KB
/
jbb_https.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /bin/bash
read -p "Enter your GitHub username (default: abikesa): " GITHUB_USERNAME
GITHUB_USERNAME=${GITHUB_USERNAME:-abikesa}
read -p "Enter your GitHub repository name (default: worthy): " REPO_NAME
REPO_NAME=${REPO_NAME:-worthy}
read -p "Enter your email address (default: [email protected]): " EMAIL_ADDRESS
EMAIL_ADDRESS=${EMAIL_ADDRESS:[email protected]}
read -p "Enter your root directory (e.g., ~/Dropbox/1f.ἡἔρις,κ/1.ontology, default: /documents/rhythm): " ROOT_DIR
ROOT_DIR=${ROOT_DIR:-/documents/rhythm}
read -p "Enter the name of the subdirectory to be built within the root directory (default: local): " SUBDIR_NAME
SUBDIR_NAME=${SUBDIR_NAME:-local}
read -p "Enter your commit statement: " COMMIT_THIS
git config --local user.name "$GITHUB_USERNAME"
git config --local user.email "$EMAIL_ADDRESS"
cd "$(eval echo $ROOT_DIR)"
rm -rf $SUBDIR_NAME/_build
jb build $SUBDIR_NAME
rm -rf $REPO_NAME
if [ -d "$REPO_NAME" ]; then
echo "Directory $REPO_NAME already exists. Choose another directory or delete the existing one."
exit 1
fi
git clone "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
if [ ! -d "$REPO_NAME" ]; then
echo "Failed to clone the repository. Check your GitHub username, repository name, and permissions."
exit 1
fi
cp -r $SUBDIR_NAME/* $REPO_NAME
cd $REPO_NAME
git add ./*
git commit -m "$COMMIT_THIS"
git remote -v
git remote set-url origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
git config --local user.name "$GITHUB_USERNAME"
git config --local user.email "$EMAIL_ADDRESS"
# Checkout the main branch
git checkout main
if [ $? -ne 0 ]; then
echo "Failed to checkout the main branch. Make sure it exists in the repository."
exit 1
fi
cd local/kitabo/ensi && git push -u origin main
if [ $? -ne 0 ]; then
echo "Failed to push to the repository. Check your credentials and GitHub permissions."
exit 1
fi
cd kitabo/ensi && ghp-import -n -p -f _build/html
echo "Jupyter Book content updated and pushed to $GITHUB_USERNAME/$REPO_NAME repository!"