diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 521bf6fed4faef19134f7f1faae0cd163cf586dc..2caca1592b2f74e68cd6d17a199e050e0e729f6a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,51 +1,38 @@ -image: ruby:latest +image: ruby:3.2.2-bookworm stages: - build - deploy variables: - GEM_HOME: $CI_PROJECT_DIR/vendor/bundle - -cache: - paths: - - vendor/bundle - -before_script: - - bundle config set --local path 'vendor/bundle' - - bundle install + JEKYLL_ENV: production + LC_ALL: C.UTF-8 build-page: stage: build + variables: + JEKYLL_ENV: production + before_script: + - gem install bundler + - bundle install + - wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 --no-verbose -O /usr/local/bin/yq + - chmod +x /usr/local/bin/yq script: - | - if [[ "$CI_COMMIT_BRANCH" == "main" ]]; then - echo "Building draft site..." - JEKYLL_ENV=production bundle exec jekyll build --config _config_draft.yml --destination public - elif [[ "$CI_COMMIT_BRANCH" == "publish" ]]; then - echo "Building production site..." - JEKYLL_ENV=production bundle exec jekyll build --config _config.yml --destination public + if [ "$CI_COMMIT_BRANCH" == "publish" ] || [ "$CI_COMMIT_BRANCH" == "main" ]; then + echo "Running on branch $CI_COMMIT_BRANCH" + ./build-page.sh "/" true else - echo "Branch is neither main nor publish. Skipping build." - exit 1 + echo "Running on other branches" + ./build-page.sh /draft false fi - - cp _config.yml public/ - - cp _config_draft.yml public/ - - cp home.md public/ - - cp -R _includes public/ - - cp -R _layouts public/ - - cp -R _sass public/ - - cp -R assets public/ - - cp Gemfile public/ - - cp Gemfile.lock public/ - - echo "Listing contents of public directory:" - - ls -laR public artifacts: paths: - public - expire_in: 1 week 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 @@ -66,7 +53,8 @@ deploy-draft: name: draft url: https://mude.citg.tudelft.nl/2024/draft rules: - - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_COMMIT_BRANCH == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" + when: always deploy-production: stage: deploy @@ -87,4 +75,5 @@ deploy-production: name: production url: https://mude.citg.tudelft.nl/2024 rules: - - if: $CI_COMMIT_BRANCH == "publish" + - if: $CI_COMMIT_BRANCH == "publish" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" + when: always diff --git a/_config.yml b/_config.yml index 137d8a9569c5ebb00113931d6e2074f7a6acc731..fbeec909c7416f711fcc97e6bc8b693fd016065d 100644 --- a/_config.yml +++ b/_config.yml @@ -98,3 +98,6 @@ compress_html: startings: [] blanklines: false profile: false + +is_draft: true +draft_banner: "This is the DRAFT version of the MUDE 2024 website. Content may change frequently." \ No newline at end of file