-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.sh
32 lines (28 loc) · 1 KB
/
push.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
#!/usr/bin/env bash
# chmod +x push.sh
#GITHUB_TOKEN
[ -z $GITHUB_TOKEN ] && GITHUB_TOKEN=$(cat .github.token)
[ -z $GITHUB_PROJECT ] && GITHUB_PROJECT=$(cat .github.project)
#flatedit
#cp -fv README.md md/index.md
yarn build || exit
cp -f -r md/.vitepress/dist/* .
cp -f -r md/img/* ./img
#rm README.md
MESSAGE=$1
MESSAGE="update docs"
[ -z "$MESSAGE" ] && read -p "Enter message for commit: " MESSAGE
git status # To check the status of working tree
git add . # To add the changes in local repository
if [ -n "$(git status - porcelain)" ];
then
echo "IT IS CLEAN"
else
git commit -m "${MESSAGE}" # To commit the changes and prepare it for remote repository
git status # To check the status of working tree
fi
#git add . # To add the changes in local repository
git commit -a -m "${MESSAGE}" # To commit the changes and prepare it for remote repository
git remote add origin "${GITHUB_PROJECT}"
echo "Pushing data to remote server: ${GITHUB_PROJECT}"
git push -u origin master # To push the changes in remote repository