diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa6b6a8c56e02ec14af7c3ccd90e7f7848cb05e5..855647263c82a7a007f34235237ff59e9f57bdf0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,10 +3,23 @@ image: entrypoint: [""] stages: + - mirror - test - build - deploy +Mirror to Github: + stage: mirror + image: debian:stable + script: + - apt update -y && apt install openssh-client git -y + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 + - chmod 600 ~/.ssh/id_ed25519 + - ssh-keyscan -H github.com >> ~/.ssh/known_hosts + - git push --mirror git@github.com:imranh2/marvin.git + Run Tests: stage: test image: node:lts @@ -47,4 +60,4 @@ Deploy Tag: - ssh root@192.168.10.59 "docker docker rmi --force $CI_REGISTRY_IMAGE 2>/dev/null || true" - ssh root@192.168.10.59 "docker run -d --name marvin -v /opt/marvin/.env:/opt/nodeapp/.env $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" environment: - name: production \ No newline at end of file + name: production