Add configuration-File support.
This commit is contained in:
parent
a85e2a090e
commit
ce035d9186
3 changed files with 73 additions and 10 deletions
10
README.md
10
README.md
|
|
@ -11,6 +11,16 @@
|
|||
This image is based on the python:3.11-alpine image and includes additional
|
||||
Python-packages for building nikola-sites.
|
||||
|
||||
## Configure your project
|
||||
|
||||
Create a configuration file in your git-repo: `.deployment-helper`
|
||||
|
||||
Configuration-Variables:
|
||||
|
||||
* DEPLOY_HELPER_ENABLE_NIKOLA (default: true)
|
||||
* DEPLOY_HELPER_ENABLE_NODE (default: false)
|
||||
* DEPLOY_HELPER_CONTENT_DIR (default: "website/output")
|
||||
|
||||
## lftp for sftp-Uploads
|
||||
|
||||
This image includes `lftp` to upload files to a sftp-server and use
|
||||
|
|
|
|||
51
bin/build.sh
51
bin/build.sh
|
|
@ -1,18 +1,59 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Default configurations:
|
||||
DEPLOY_HELPER_ENABLE_NIKOLA=true
|
||||
DEPLOY_HELPER_ENABLE_NODE=false
|
||||
|
||||
if test -f .deployment-helper
|
||||
then
|
||||
# shellcheck source=/dev/null
|
||||
. .deployment-helper
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if $DEPLOY_HELPER_ENABLE_NODE
|
||||
then
|
||||
if ! command -v node >/dev/null 2>&1
|
||||
then
|
||||
echo "node not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v npm >/dev/null 2>&1
|
||||
then
|
||||
echo "npm not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if ! test -d node
|
||||
then
|
||||
echo "Node directory not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd node || { echo 'Directory "node" not found'; exit 1;}
|
||||
if ! npm install
|
||||
then
|
||||
echo "Error installing node-dependencies" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
cd ..
|
||||
fi
|
||||
|
||||
if $DEPLOY_HELPER_ENABLE_NIKOLA
|
||||
then
|
||||
if ! test -d website
|
||||
then
|
||||
echo "Website directory not found"
|
||||
echo "Website directory not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v nikola >/dev/null 2>&1
|
||||
then
|
||||
echo "nikola command not found"
|
||||
echo "nikola command not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd website
|
||||
|
||||
cd website || { echo 'Directory "website" not found'; exit 1;}
|
||||
nikola build
|
||||
cd ..
|
||||
fi
|
||||
exit "$?"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Default configurations:
|
||||
DEPLOY_HELPER_CONTENT_DIR="website/output"
|
||||
|
||||
if ! test -d website/output
|
||||
if test -f .deployment-helper
|
||||
then
|
||||
# shellcheck source=/dev/null
|
||||
. .deployment-helper
|
||||
fi
|
||||
|
||||
|
||||
if ! test -d "${DEPLOY_HELPER_CONTENT_DIR}"
|
||||
then
|
||||
echo "Website-Build not found"
|
||||
exit 1
|
||||
|
|
@ -16,6 +25,9 @@ then
|
|||
fi
|
||||
|
||||
|
||||
lftp -e 'set sftp:auto-confirm yes; mirror -R ./website/output/ ./web/; bye' --env-password -u ${SSH_USER} sftp://${SSH_HOST}
|
||||
lftp -e "set sftp:auto-confirm yes; mirror -R ${DEPLOY_HELPER_CONTENT_DIR} ./web/; bye" \
|
||||
--env-password \
|
||||
-u ${SSH_USER} \
|
||||
sftp://${SSH_HOST}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue