Skip to content

Instantly share code, notes, and snippets.

@einnar82
Created April 14, 2020 03:29
Show Gist options
  • Save einnar82/542c11c35b68771f29a1d0081d522c9e to your computer and use it in GitHub Desktop.
Save einnar82/542c11c35b68771f29a1d0081d522c9e to your computer and use it in GitHub Desktop.
Vue.js CI CD Yaml Template
# prerequisites: must install scp or rsync for both machines
stages:
- build
- deploy
# build stage
build_app:
image: node:alpine
stage: build
only:
- develop
script:
- npm install
- npm run build
cache:
paths:
- node_modules/
artifacts:
paths:
# build folder
- dist/
expire_in: 1 hour
# production stage
production:
image: alpine
stage: deploy
script:
- apk add --no-cache rsync openssh
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- rsync -rav --delete 'ssh -o ConnectTimeout=240' dist/ [email protected]:/var/www/dev.fis.perahub.com.ph/dist/
when: manual
only:
- develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment