Merge pull request 'Repair deploy script' (#23) from maintenance into main
Reviewed-on: #23
This commit is contained in:
commit
75e6dcf074
|
@ -1,4 +1,5 @@
|
||||||
|
.hugo_build.lock
|
||||||
|
.idea/
|
||||||
public/
|
public/
|
||||||
resources/
|
resources/
|
||||||
themes/*_dev
|
themes/*_dev
|
||||||
.idea/
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#set -x # Display the value of PS4, followed by the command and its arguments.
|
||||||
set -e # Exit immediately if a command exits with a non-zero status.
|
set -e # Exit immediately if a command exits with a non-zero status.
|
||||||
set -u # Treat unset variables as an error when substituting.
|
set -u # Treat unset variables as an error when substituting.
|
||||||
|
|
||||||
|
@ -28,12 +29,15 @@ purge_local () {
|
||||||
# clone repo if not already there
|
# clone repo if not already there
|
||||||
clone_local () {
|
clone_local () {
|
||||||
if [ ! -d "$CLONE_DIR" ]; then
|
if [ ! -d "$CLONE_DIR" ]; then
|
||||||
git clone \
|
if ! git clone \
|
||||||
--quiet \
|
--quiet \
|
||||||
--branch "$BRANCH" \
|
--branch "$BRANCH" \
|
||||||
--recurse-submodules \
|
--recurse-submodules \
|
||||||
"${GIT_BASE}/${OWNER}/${REPO}.git" \
|
"${GIT_BASE}/${OWNER}/${REPO}.git" \
|
||||||
"$CLONE_DIR"
|
"$CLONE_DIR"
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,11 +73,14 @@ latest_local_sha () {
|
||||||
|
|
||||||
# get latest commit id of server
|
# get latest commit id of server
|
||||||
latest_remote_sha () {
|
latest_remote_sha () {
|
||||||
curl -sq \
|
if ! curl --silent --fail --show-error \
|
||||||
-X GET \
|
-X GET \
|
||||||
-H "accept: application/json" \
|
-H "accept: application/json" \
|
||||||
"${GIT_BASE}/api/v1/repos/${OWNER}/${REPO}/commits?sha=${BRANCH}&limit=1" \
|
"${GIT_BASE}/api/v1/repos/${OWNER}/${REPO}/commits?sha=${BRANCH}&limit=1" \
|
||||||
| jq -M -r '.[0].sha'
|
| jq -M -r '.[0].sha'
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue