mirror of
https://mau.dev/andreijiroh-dev/website.git
synced 2025-05-16 02:23:08 +00:00
ci(gitlab-ci): update deploy scripts and add .env.ci managed by dotenvx
Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.xyz>
This commit is contained in:
parent
e954a7fa74
commit
cc340223f9
4 changed files with 45 additions and 26 deletions
29
bin/build.sh
29
bin/build.sh
|
@ -1,28 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
TARGET_DIR=${TARGET_DIR:-"$PWD/public"}
|
||||
FF_OFFLINE_MKDOCS_PLUGIN=${FF_OFFLINE_MKDOCS_PLUGIN:-"false"}
|
||||
FF_ENABLE_COMMIT_DATA=${FF_ENABLE_COMMIT_DATA:-"true"}
|
||||
FF_GENERATE_SOCIAL_CARDS=${FF_GENERATE_SOCIAL_CARDS:-"true"}
|
||||
TARGET_BUILD_CONFIG=${1:-"mkdocs.yml"}
|
||||
|
||||
if [[ ! -d "$TARGET_DIR" ]]; then
|
||||
mkdir "$TARGET_DIR" -pv
|
||||
fi
|
||||
|
||||
if [[ $SKIP_VENV_SETUP == "" ]] || [[ $CI == "" ]]; then
|
||||
pipenv install --ignore-pipfile --deploy --verbose
|
||||
pipenv run mkdocs build -d "$TARGET_DIR" -f ${TARGET_BUILD_CONFIG}
|
||||
else
|
||||
pip3 install -r requirements.txt --upgrade --user
|
||||
mkdocs build -d "$TARGET_DIR" -f ${TARGET_BUILD_CONFIG}
|
||||
fi
|
||||
|
||||
mkdir "$TARGET_DIR/api"
|
||||
git rev-parse HEAD > "$TARGET_DIR/api/commit"
|
||||
TARGET_DIR="${PWD}/public"
|
||||
pipenv run build
|
||||
cp "$TARGET_DIR/assets/images/favicon.png" "$TARGET_DIR/favicon.ico"
|
||||
cp markdown/.well-known "$TARGET_DIR/.well-known" -rv
|
||||
cp markdown/humans.txt "$TARGET_DIR/humans.txt" -v
|
||||
|
||||
set +xe
|
||||
cp markdown/.well-known markdown/humans.txt "$TARGET_DIR/" -rv
|
||||
|
|
24
bin/deploy.sh
Executable file
24
bin/deploy.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ea
|
||||
if [[ $DEBUG != "" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
_root_directory_git=$(git rev-parse --show-toplevel)
|
||||
|
||||
warn() {
|
||||
echo "warning: $*"
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "error: $*"
|
||||
}
|
||||
|
||||
info() {
|
||||
echo "info: $*"
|
||||
}
|
||||
|
||||
if [[ $CI == "true" ]] && [[ $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web" ]]
|
||||
&& [[ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]]; then
|
||||
npx wrangler pages publish ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch main
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue