From e5664cd1ac731b20db7098247bd4d08ab3974a85 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 23 Aug 2024 16:04:23 +0200 Subject: [PATCH] Update 4 files - /_config_draft.yml - /_config.yml - /.gitlab-ci.yml - /build-page.sh --- .gitlab-ci.yml | 12 ++++++------ _config.yml | 5 +---- _config_draft.yml | 1 + build-page.sh | 20 +++----------------- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28de565..335df3b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,8 +10,6 @@ variables: build-page: stage: build - variables: - JEKYLL_ENV: production before_script: - gem install bundler - bundle install @@ -21,9 +19,11 @@ build-page: script: - | if [ "$CI_COMMIT_BRANCH" == "publish" ]; then - ./build-page.sh "/" true + echo "Running production build for publish branch" + ./build-page.sh "/" "_config.yml" elif [ "$CI_COMMIT_BRANCH" == "main" ]; then - ./build-page.sh "/draft" false + echo "Running draft build for main branch" + ./build-page.sh "/draft" "_config_draft.yml" else echo "Branch $CI_COMMIT_BRANCH is not configured for building." exit 1 @@ -43,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: YOUR_SECRET_TOKEN" \ + -H "X-Gitlab-Token: YOUR_TOKEN_HERE" \ -d '{ "object_kind": "pipeline", "object_attributes": { @@ -65,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: YOUR_SECRET_TOKEN" \ + -H "X-Gitlab-Token: YOUR_TOKEN_HERE" \ -d '{ "object_kind": "pipeline", "object_attributes": { diff --git a/_config.yml b/_config.yml index 60e558c..1ad5464 100644 --- a/_config.yml +++ b/_config.yml @@ -97,7 +97,4 @@ compress_html: endings: all startings: [] blanklines: false - profile: false - -is_draft: true -draft_banner: "This is the DRAFT version of the MUDE 2024 website. Content may change frequently." + profile: false \ No newline at end of file diff --git a/_config_draft.yml b/_config_draft.yml index 1162361..23ce034 100644 --- a/_config_draft.yml +++ b/_config_draft.yml @@ -99,4 +99,5 @@ compress_html: blanklines: false profile: false +is_draft: true draft_banner: "This is the DRAFT version of the MUDE 2024 website. Content may change frequently." diff --git a/build-page.sh b/build-page.sh index dfd5020..8219c62 100644 --- a/build-page.sh +++ b/build-page.sh @@ -1,26 +1,12 @@ #!/bin/bash PAGE_ROOT=${1:-"/"} -IS_PUBLISH_DEPLOYMENT=${2:-false} +CONFIG_FILE=${2:-"_config.yml"} PAGE_ROOT=$(echo "$PAGE_ROOT" | sed 's:/*$::') -if [ "$IS_PUBLISH_DEPLOYMENT" = true ]; then - echo "Using publish deployment strategy" - CONFIG_FILE="_config.yml" -else - echo "Using draft deployment strategy" - 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" --config "$CONFIG_FILE" -# Check the build result -if [ $? -ne 0 ]; then - echo "Jekyll build failed" - exit 1 -else - echo "Jekyll build succeeded" -fi +# Execute the Jekyll build command with the selected config file +bundle exec jekyll build -d public -b "$PAGE_ROOT" --config "$CONFIG_FILE" -- GitLab