-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update remote git repo to newest deployed version, remote git pull (#55)
* Add script for remotely git pull on server from GitHub Action * Modify Github Action to use the remote git pull script
- Loading branch information
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/bash | ||
|
||
PATH=$(/usr/bin/getconf PATH || /bin/kill $$) | ||
|
||
die() { | ||
echo "[!] Something went wrong, exiting..." | ||
exit 1 | ||
} | ||
|
||
echo "[+] Connected to iscsc.fr" | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "[!] Must provide one and only one argument: repo path on remote"; | ||
die; | ||
fi | ||
REPO_PATH="$1"; shift | ||
|
||
echo "[+] Change directory" | ||
cd ${REPO_PATH} || die | ||
|
||
REMOTE_URL="iscsc/blog.iscsc.fr" | ||
REMOTE_NAME=$(git remote -v | grep --ignore-case "${REMOTE_URL}" | grep "(fetch)" | awk '{print $1}') | ||
MAIN_BRANCH_NAME=main | ||
|
||
echo "[+] iScsc remote name is '${REMOTE_NAME}'" | ||
echo "[+] Fetch '${MAIN_BRANCH_NAME}' from '${REMOTE_NAME}'" | ||
git fetch "${REMOTE_NAME}" "${MAIN_BRANCH_NAME}" || die | ||
|
||
echo "[+] Checkout on '${MAIN_BRANCH_NAME}'" | ||
git checkout "${MAIN_BRANCH_NAME}" || die | ||
|
||
REMOTE_MAIN_REF_NAME="${REMOTE_NAME}/${MAIN_BRANCH_NAME}" | ||
|
||
echo "[+] Remote ref is '${REMOTE_MAIN_REF_NAME}'" | ||
echo "[+] Rebase on '${REMOTE_MAIN_REF_NAME}'" | ||
git rebase "${REMOTE_MAIN_REF_NAME}" || die | ||
|
||
echo "[+] git log from here:" | ||
git log --color --decorate --oneline --max-count=20 main | ||
|