Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.47 KiB
image: node:14.17.1-slim

stages:
  - 🧪 test
  - 📝 publish
  - 🧽 clean

variables:
  SUB_GROUP:          "www"
  DOCUSAURUS_BASEURL: /


lint:
  stage: 🧪 test
  tags:
    - cache
  script: 
    - npm install
    - npm run lint
  cache:
    key:
      files:
        - package.json
    paths:
      - node_modules

pages:
  stage: 📝 publish
  tags:
    - cache
  script:
    - npm run build
    - mv build public
  artifacts:
    paths:
      - public
  cache:
    key:
      files:
        - package.json
    paths:
      - node_modules
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  environment:
    name: production
    url: "${DOCUSAURUS_URL}"

pages:preview:
  extends: pages
  artifacts:
    expire_in: 2 week
  rules:
    - if: $CI_MERGE_REQUEST_IID
      variables:
          DOCUSAURUS_URL:     "https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}"
          DOCUSAURUS_BASEURL: "/-/${SUB_GROUP}/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts/public/"

  environment:
    name: preview/${CI_COMMIT_REF_NAME}
    url: "https://${CI_PROJECT_ROOT_NAMESPACE}.${CI_PAGES_DOMAIN}/-/${SUB_GROUP}/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts/public/index.html"
    on_stop: pages:preview:stop

pages:preview:stop:
  stage: 🧽 clean
  rules:
    - if: $CI_MERGE_REQUEST_IID
      when: manual
  allow_failure: true
  environment: