Skip to content
Snippets Groups Projects
Commit 64bb9694 authored by Hoang  PHAN's avatar Hoang PHAN
Browse files

Update .gitlab-ci.yml file

parent 2439ca39
No related branches found
No related tags found
No related merge requests found
Pipeline #50165 passed
# This file is a template, and might need editing before it works on your project.
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
# SPDX-FileCopyrightText: 2024 eclipse foundation
# SPDX-License-Identifier: EPL-2.0
include:
- project: 'eclipsefdn/it/releng/gitlab-runner-service/gitlab-ci-templates'
file: 'pipeline-autodevops.gitlab-ci.yml'
- project: 'eclipsefdn/it/releng/gitlab-runner-service/gitlab-ci-templates'
file: '/jobs/git.gitlab-ci.yml'
default:
tags:
- origin:eclipse
stages:
- build
- test
- deploy
variables:
DART_SASS_VERSION: 1.77.5
HUGO_VERSION: 0.128.0
NODE_VERSION: 20.x
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
TZ: America/Los_Angeles
GIT_SUBMODULE_FORCE_HTTPS: "true"
HUGO_ENV: production
CI_IMAGE_HUGO: eclipsecbi/hugo_extended:0.110.0
image:
name: golang:1.22.1-bookworm
pages:
build-hugo:
image: $CI_IMAGE_HUGO
stage: build
script:
# Install brotli
- apt-get update
- apt-get install -y brotli
# Install Dart Sass
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- cp -r dart-sass/ /usr/local/bin
- rm -rf dart-sass*
- export PATH=/usr/local/bin/dart-sass:$PATH
# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
# Install Node.js
- curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
- apt-get install -y nodejs
# Install Node.js dependencies
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
# Build
- hugo --gc --minify
# Compress
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \;
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \;
- hugo -b https://eclipse.dev/${EF_SHORT_NAME}/
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
push-modification:
extends: .ef-git
stage: deploy
needs:
- job: build-hugo
artifacts: true
# variables:
# GIT_REMOTE_URL: "<to define git://gitlab.eclipse.org:eclipse/${EF_SHORT_NAME}/website.git>"
script:
- |
git add -A
if ! git diff --cached --exit-code; then
echo "Changes have been detected, publishing to repo '$GIT_REMOTE_URL'"
git commit -m "Website build - job: $CI_JOB_NAME-$CI_JOB_ID \
Build logs: $CI_JOB_URL"
git log --graph --abbrev-commit --date=relative -n 5
git push origin HEAD:$CI_DEFAULT_BRANCH;
else
echo "No changes have been detected, nothing to publish"
fi
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
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