Skip to content
Snippets Groups Projects
Commit 48b5b2a9 authored by François Grand's avatar François Grand
Browse files

refactor(ci) : .gitlab-ci.yml : use DEV_xx/PROD_xx variables from Gitlab CI/CD environment

refs #505
parent fc6d4f14
No related branches found
No related tags found
No related merge requests found
...@@ -10,13 +10,20 @@ stages: ...@@ -10,13 +10,20 @@ stages:
- releases-version - releases-version
variables: variables:
# from Gitlab CI/CD environment variables :
# - development server :
# DEV_HOST : deployment server hostname
# DEV_LOGIN : user on deployment server
# DEV_PATH : path base on deployment server
# - production server :
# PROD_HOST : deployment server hostname
# PROD_LOGIN : user on deployment server
# PROD_PASS : password for user on deployment server
# PROD_PATH : path base on deployment server
LC_ALL: C.UTF-8 LC_ALL: C.UTF-8
ANDROID_HOME: "/usr/local/android-sdk" # should already be defined in the Docker image ANDROID_HOME: "/usr/local/android-sdk" # should already be defined in the Docker image
ANDROID_SDK_ROOT: "/usr/local/android-sdk" # should already be defined in the Docker image ANDROID_SDK_ROOT: "/usr/local/android-sdk" # should already be defined in the Docker image
DEPLOY_HOST_LOGIN: "nghyd@aubes" RELEASES_PATH: "$PROD_PATH/cassiopee-releases"
DEPLOY_URL: "/var/www/html/cassiopee"
DEPLOY_STABLE_URL: "/var/www/cassiopee-production"
RELEASES_URL: "$DEPLOY_STABLE_URL/cassiopee-releases"
before_script: before_script:
# load private key from GitLab CI variable, to deploy on Aubes server # load private key from GitLab CI variable, to deploy on Aubes server
...@@ -91,7 +98,7 @@ clean-stale-branches: ...@@ -91,7 +98,7 @@ clean-stale-branches:
- tags - tags
- web - web
script: script:
- ./scripts/remove-stale-branches.sh $DEPLOY_HOST_LOGIN $DEPLOY_URL - ./scripts/remove-stale-branches.sh $DEV_LOGIN@$DEV_HOST $DEV_PATH
deploy-dev: deploy-dev:
stage: deploy-dev stage: deploy-dev
...@@ -103,7 +110,7 @@ deploy-dev: ...@@ -103,7 +110,7 @@ deploy-dev:
- build - build
script: script:
# Copie de la branche / du tag # Copie de la branche / du tag
- rsync --delete -a "dist/" "$DEPLOY_HOST_LOGIN:$DEPLOY_URL/$CI_COMMIT_REF_NAME" - rsync --delete -a "dist/" "$DEV_LOGIN@$DEV_HOST:$DEV_PATH/$CI_COMMIT_REF_NAME"
deploy-prod: deploy-prod:
stage: deploy-prod stage: deploy-prod
...@@ -114,9 +121,9 @@ deploy-prod: ...@@ -114,9 +121,9 @@ deploy-prod:
- build - build
script: script:
# Copie de la branche production # Copie de la branche production
- rsync --delete -a "dist/" "$DEPLOY_HOST_LOGIN:$DEPLOY_STABLE_URL/" - rsync --delete -a "dist/" "$PROD_LOGIN@$PROD_HOST:$PROD_PATH/"
# Modification du dossier base href # Modification du dossier base href
- ssh $DEPLOY_HOST_LOGIN "sed -i 's:/cassiopee/stable/:/:g' $DEPLOY_STABLE_URL/index.html" - ssh $PROD_LOGIN@PROD_HOST "sed -i 's:/cassiopee/stable/:/:g' $PROD_PATH/index.html"
releases-nightly: releases-nightly:
stage: releases-nightly stage: releases-nightly
...@@ -124,11 +131,7 @@ releases-nightly: ...@@ -124,11 +131,7 @@ releases-nightly:
- schedules - schedules
dependencies: [] dependencies: []
script: script:
- npm run release-all - ./scripts/release-version.sh nightly $PROD_LOGIN $PROD_HOST $RELEASES_PATH
- find release -name "fr.irstea.cassiopee_*.deb" -exec scp "{}" $DEPLOY_HOST_LOGIN:$RELEASES_URL/linux-nightly.deb \;
- find release -name "Cassio*Setup*.exe" -exec scp "{}" $DEPLOY_HOST_LOGIN:$RELEASES_URL/windows-nightly.exe \;
- find release -name "Cassio*-mac.zip" -exec scp "{}" $DEPLOY_HOST_LOGIN:$RELEASES_URL/macos-nightly.zip \;
- find release -name "cassiopee-*.apk" -exec scp "{}" $DEPLOY_HOST_LOGIN:$RELEASES_URL/android-nightly.apk \;
releases-version: releases-version:
stage: releases-version stage: releases-version
...@@ -137,4 +140,4 @@ releases-version: ...@@ -137,4 +140,4 @@ releases-version:
- $CI_COMMIT_REF_NAME =~ /^[0-9]+\.[0-9]+\.[0-9]+$/ # version tag - $CI_COMMIT_REF_NAME =~ /^[0-9]+\.[0-9]+\.[0-9]+$/ # version tag
dependencies: [] dependencies: []
script: script:
- ./scripts/release-version.sh $CI_COMMIT_REF_NAME $DEPLOY_HOST_LOGIN $RELEASES_URL - ./scripts/release-version.sh $CI_COMMIT_REF_NAME $PROD_LOGIN $PROD_HOST $RELEASES_PATH
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