How to GitLab Shared Runners deploy to server

Viewed 239

I want deploy my react app.

I think use ssh, but the docs say how use ssh key using own gitlab runner but i want use the shared runners to this.

I dont know how send the build folder to my server, i was thing in ftp but what is the best way to make this?.

I dont use docker, just plain apache server.

1 Answers

i found the solution

image: node:latest

cache:
  paths:
  - node_modules/

stages:
  - deploy

deploy:
  stage: deploy
  script:
    - unset CI
    - npm install
    - npm run build
    - apt-get update -qq && apt-get install -y -qq lftp
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -R ./build $DEV_FOLDER --Remove-source-files --delete-first --parallel=10 --exclude-glob .git* --exclude .htaccess --exclude .git/"
  only:
    - master

Related