10
0
mirror of https://github.com/Llewellynvdm/Joomla-XML-Lang-stream.git synced 2024-11-23 19:17:33 +00:00

Adds push to github control.

This commit is contained in:
Llewellyn van der Merwe 2021-06-01 07:04:40 +02:00
parent c1a8058e3a
commit bd5547a9b6
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
4 changed files with 37 additions and 1 deletions

View File

@ -26,4 +26,4 @@ jobs:
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/vdm-io/github-user/master/src/setup.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL"
- name: Build the XML static Files
run: |
/bin/bash ./run.sh --conf="conf/mapper.tmp"
/bin/bash ./run.sh --conf="conf/mapper.tmp" --push

View File

@ -59,6 +59,12 @@ You are able to change a few default behaviours in the getBible API builder
defaults:
- repo/conf/.mapper
======================================================
--push
push changes to github (only if there are changes)
- must be able to push (ssh authentication needed)
example: ${0##*/:-} --push
======================================================
--target-folder=<path>
set folder where we place the XML static files

View File

@ -19,6 +19,9 @@ xml.stream.url.language.key=language_code
# xml stream mapper file
xml.stream.repo.mapper=/home/username/XML-stream/conf/.mapper
# xml stream push xml updates back to git server 0->no; 1->yes (assumes user is having ssh access configured)
xml.stream.repo.push=0
# xml stream target folder where we place the XML static files
xml.stream.target.folder=/home/username/XML-stream/src/

27
run.sh
View File

@ -57,6 +57,21 @@ function main() {
fi
done < "${PATH_MAIN_FILE}"
done < "$REPO_MAPPER"
# check if we should update the repo
if (("$PUSH" == 1)); then
# we first check if there are changes
if [[ -z $(git status --porcelain) ]];
then
echo "Nothing to commit here"
else
# make sure all new files are added and others removed where needed
git add .
# now commit the bunch...
git commit -am "Update"
# now push changes up to github...
git push
fi
fi
# show completion message
completedBuildMessage
exit 0
@ -107,6 +122,7 @@ function setDefaults() {
URL_VERSION_KEY=$(getDefault "xml.stream.url.version.key" "${URL_VERSION_KEY}")
URL_LANGUAGE_KEY=$(getDefault "xml.stream.url.language.key" "${URL_LANGUAGE_KEY}")
REPO_MAPPER=$(getDefault "xml.stream.repo.mapper" "${REPO_MAPPER}")
PUSH=$(getDefault "xml.stream.repo.push" "$PUSH")
TARGET_FOLDER=$(getDefault "xml.stream.target.folder" "${TARGET_FOLDER}")
QUIET=$(getDefault "xml.stream.build.quiet" "$QUIET")
fi
@ -153,6 +169,12 @@ You are able to change a few default behaviours in the XML Stream Generator
defaults:
- repo/conf/.mapper
======================================================
--push
push changes to github (only if there are changes)
- must be able to push (ssh authentication needed)
example: ${0##*/:-} --push
======================================================
--target-folder=<path>
set folder where we place the XML static files
@ -198,6 +220,7 @@ URL_LANGUAGE_KEY="language_code"
REPO_MAPPER='conf/.mapper'
TARGET_FOLDER='src/'
CONFIG_FILE='conf/.config'
PUSH=0
DRYRUN=0
QUIET=0
@ -214,6 +237,9 @@ while :; do
--dry)
DRYRUN=1
;;
--push)
PUSH=1
;;
--version-key) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
URL_VERSION_KEY=$2
@ -311,6 +337,7 @@ if (("$DRYRUN" == 1)); then
echo "URL_VERSION_KEY: ${URL_VERSION_KEY}"
echo "URL_LANGUAGE_KEY: ${URL_LANGUAGE_KEY}"
echo "REPO_MAPPER: ${REPO_MAPPER}"
echo "PUSH: ${PUSH}"
echo "CONFIG_FILE: ${CONFIG_FILE}"
echo "TARGET_FOLDER: ${TARGET_FOLDER}"
echo "QUIET: ${QUIET}"