Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c5c7b72d authored by Yannick Li's avatar Yannick Li
Browse files

CI: Setup automatic website deployment

parent 074c5d4a
Branches
Tags
2 merge requests!24Resolve "Release v1.0.1",!21Resolve "Deploy to website"
Pipeline #242094 passed
Pipeline: c-sudoku

#242096

    Pipeline: c-sudoku

    #242095

      ......@@ -3,6 +3,8 @@ image: node:14.16.0
      stages:
      - build
      - test
      - predeploy
      - deploy
      cache: &global_cache # per-branch cache
      key: ${CI_COMMIT_REF_SLUG}
      ......@@ -60,4 +62,86 @@ test:
      coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
      artifacts:
      paths:
      - coverage/
      - collaborative/coverage/
      # Filter out node_modules from build artifacts to speed up deploy.
      # Gitlab 13.10 will allow to use multiple cache instead.
      pre-deploy:
      stage: predeploy
      rules:
      - if: "$CI_COMMIT_BRANCH"
      # use only artifacts from build job
      dependencies:
      - build
      # cache is not needed: don't download
      cache: {}
      # don't download repository content
      variables:
      GIT_STRATEGY: none
      artifacts:
      paths:
      - collaborative/build/
      # script is required
      script:
      - echo Exporting collaborative/build/…
      deploy_review:
      stage: deploy
      rules:
      - if: "$CI_COMMIT_BRANCH"
      tags:
      - webserver
      environment:
      name: review/$CI_COMMIT_REF_NAME
      url: https://demo.concordant.io/c-sudoku_${CI_ENVIRONMENT_SLUG}/
      on_stop: stop_review
      # use only artifacts from pre-deploy job
      dependencies:
      - pre-deploy
      # cache and repository art not needed: don't download
      cache: {}
      variables:
      GIT_STRATEGY: none
      script:
      - rm -rf /var/www/demo.concordant.io/html/c-sudoku_${CI_ENVIRONMENT_SLUG}
      - mv collaborative/build /var/www/demo.concordant.io/html/c-sudoku_${CI_ENVIRONMENT_SLUG}
      stop_review:
      stage: deploy
      rules:
      - if: "$CI_COMMIT_BRANCH"
      when: manual
      allow_failure: true
      tags:
      - webserver
      environment:
      name: review/$CI_COMMIT_REF_NAME
      action: stop
      # artifacts, cache and repository are not needed: don't download
      dependencies: []
      cache: {}
      variables:
      GIT_STRATEGY: none
      script:
      - rm -rf /var/www/demo.concordant.io/html/c-sudoku_${CI_ENVIRONMENT_SLUG}
      deploy_live:
      stage: deploy
      rules:
      - if: '$CI_COMMIT_BRANCH == "master"'
      when: manual
      tags:
      - webserver
      environment:
      name: live
      url: https://demo.concordant.io/c-sudoku/
      # use only artifacts from pre-deploy job
      dependencies:
      - pre-deploy
      # cache and repository art not needed: don't download
      cache: {}
      variables:
      GIT_STRATEGY: none
      script:
      - rm -rf /var/www/demo.concordant.io/html/c-sudoku
      - mv collaborative/build /var/www/demo.concordant.io/html/c-sudoku
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Please register or to comment