From 7201a3f57155edd0c23dac85f2c7020b89477961 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Sat, 27 Jul 2024 13:15:00 +0200 Subject: [PATCH] feat: updated gitlab ci scripts Signed-off-by: Louis Vallat --- .gitlab-ci.yml | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 282d8bf..3bda9cc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,50 +1,20 @@ -image: docker:latest -services: - - docker:dind +image: alpine + +variables: + GIT_SUBMODULE_STRATEGY: recursive stages: - - release - deploy -# Disable the Gradle daemon for Continuous Integration servers as correctness -# is usually a priority over speed in CI environments. Using a fresh -# runtime for each build is more reliable since the runtime is completely -# isolated from any previous builds. -variables: - # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled - DOCKER_HOST: tcp://docker:2376 - DOCKER_TLS_CERTDIR: "/certs" - CONTAINER_BRANCH_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest - -release: - stage: release - script: - - sed -i "s/__VERSION__/${CI_COMMIT_SHORT_SHA}/" src/index.html - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build . -t $CONTAINER_BRANCH_IMAGE - - docker push $CONTAINER_BRANCH_IMAGE - except: - - master - -release-master: - stage: release - script: - - sed -i "s/__VERSION__/${CI_COMMIT_SHORT_SHA}/" src/index.html - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker build . -t $CONTAINER_RELEASE_IMAGE - - docker push $CONTAINER_RELEASE_IMAGE - only: - - master - deploy: stage: deploy before_script: + - apk add openssh zola rsync - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh script: - - ssh -o StrictHostKeyChecking=no -p $SSH_PORT $SSH_DESTINATION "cd $PATH_TO_APPLICATION; $UPGRADE_COMMAND;" + - rsync -e "ssh -o StrictHostKeyChecking=no -p $SSH_PORT" -rvz ./src/ $SSH_DESTINATION:/var/www/louis-vallat.fr/ --delete only: - master