1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #!/usr/bin/env bash
- #
- # Upload changes from inside repository using GIN CLI
- # Assumes no submodules
- # Assumes gin init was performed or the repository was downloaded via gin get
- if (( $# > 0 )); then
- echo "This script takes no arguments"
- exit 1
- fi
- checkerror() {
- err=$1
- msg=$2
- if [[ ${err} != 0 ]]; then
- echo ${msg} >> ./log/gin.log
- echo ${msg}
- echo "Press [Enter] to close this window"
- read
- exit 1
- fi
- }
- loc=$(dirname $0)
- projectdir=$(git -C ${loc} rev-parse --show-toplevel)
- pushd ${loc} > /dev/null
- mkdir -p ./log
- echo "$(date -Iseconds): Sync script executed" >> ./log/gin.log
- gin sync
- checkerror $? "Error occurred during 'gin sync'"
- gin commit .
- checkerror $? "Error occurred during 'gin commit'"
- gin upload
- checkerror $? "Error occurred during 'gin upload'"
- # this is removing big file content if the upload is successful:
- gin remove-content
- checkerror $? "Error occurred during 'gin remove-content'"
- # Uncomment the two lines below to download all large files, you may also want to comment the gin remove-content line above
- # gin get-content .
- # checkerror $? "Error occurred during 'gin get-content'"
- popd > /dev/null
|