Skip to content
Snippets Groups Projects
Commit 226df041 authored by Kwangjin Lee's avatar Kwangjin Lee
Browse files

Update 2 files

- /build-page.sh
- /.gitlab-ci.yml
parent f55a8478
No related branches found
No related tags found
1 merge request!10merge for publish
Pipeline #245065 passed
......@@ -22,13 +22,19 @@ build-page:
- |
if [ "$CI_COMMIT_BRANCH" == "publish" ]; then
./build-page.sh "/" true
else
elif [ "$CI_COMMIT_BRANCH" == "main" ]; then
./build-page.sh "/draft" false
else
echo "Branch $CI_COMMIT_BRANCH is not configured for building."
exit 1
fi
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish"
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish"
when: always
deploy-draft:
stage: deploy
......@@ -37,7 +43,7 @@ deploy-draft:
- |
curl -X POST https://mude.citg.tudelft.nl/hooks/website-deploy-draft \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-sQ82fiSMo1kCi2TpgSfr" \
-H "X-Gitlab-Token: YOUR_SECRET_TOKEN" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
......@@ -59,7 +65,7 @@ deploy-production:
- |
curl -X POST https://mude.citg.tudelft.nl/hooks/website-deploy \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-sQ82fiSMo1kCi2TpgSfr" \
-H "X-Gitlab-Token: YOUR_SECRET_TOKEN" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
......
......@@ -7,30 +7,15 @@ PAGE_ROOT=$(echo "$PAGE_ROOT" | sed 's:/*$::')
if [ "$IS_PUBLISH_DEPLOYMENT" = true ]; then
echo "Using publish deployment strategy"
# Remove the banner which identifies the site as a draft
if ! command -v yq &>/dev/null; then
echo "yq could not be found, the draft banner cannot be removed"
echo "Please install yq (with APT or via https://github.com/mikefarah/yq#install) and try again"
else
cp _config.yml _config.yml.bak
yq -i '.is_draft = false' _config.yml
echo "is_draft set to false in _config.yml"
fi
CONFIG_FILE="_config.yml"
else
echo "Using draft deployment strategy"
# Ensure the draft flag is true for non-publish deployments
if ! command -v yq &>/dev/null; then
echo "yq could not be found, the draft banner cannot be enforced"
echo "Please install yq (with APT or via https://github.com/mikefarah/yq#install) and try again"
else
cp _config.yml _config.yml.bak
yq -i '.is_draft = true' _config.yml
echo "is_draft set to true in _config.yml"
fi
CONFIG_FILE="_config_draft.yml"
fi
echo "Using configuration file: $CONFIG_FILE"
echo "Publishing to page root: \"$PAGE_ROOT\""
bundle exec jekyll build -d public -b "$PAGE_ROOT"
bundle exec jekyll build -d public -b "$PAGE_ROOT" --config "$CONFIG_FILE"
# Check the build result
if [ $? -ne 0 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment