diff --git a/src/.gitlab-ci.yml b/src/.gitlab-ci.yml new file mode 100644 index 0000000..cfbc05a --- /dev/null +++ b/src/.gitlab-ci.yml @@ -0,0 +1,29 @@ +image: node:16 + +workflow: + rules: + - if: '$CI_COMMIT_BRANCH' + +cache: + paths: + - .yarn + +deploy: + before_script: + - apt update -yq + # Set up rsync to dev server + - apt install -y rsync + - 'which ssh-agent || ( apt install openssh-client -y )' + - mkdir -p ~/.ssh + - eval $(ssh-agent -s) + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + - ssh-add <(echo "$RSYNC_PRIVATE_KEY") + - echo "$RSYNC_PRIVATE_KEY" > ~/.ssh/id_rsa + # Install yarn & make it accessible + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" + script: + - yarn install --cache-folder .yarn + - rsync -avuz -e 'ssh -i ~/.ssh/id_rsa' public/ $RSYNC_DESTINATION + rules: + - if: '$CI_COMMIT_BRANCH == "main"'