Skip to content

Instantly share code, notes, and snippets.

@yaapis
Last active September 17, 2021 10:34
Show Gist options
  • Save yaapis/3107528442df931e19a41cf8ee9b2f89 to your computer and use it in GitHub Desktop.
Save yaapis/3107528442df931e19a41cf8ee9b2f89 to your computer and use it in GitHub Desktop.
Gitlab CI config file for deploy via SSH
before_script:
- npm -v
stages:
- setup
- codestyle
- build
- test
- deploy
Setup:
stage: setup
script:
- npm install --progress=false
cache:
key: ${CI_BUILD_REF_NAME}
paths:
- node_modules/
artifacts:
paths:
- node_modules/
CodeStyle:
stage: codestyle
script:
- ./node_modules/.bin/eslint src
Build:
stage: build
script:
- ./node_modules/.bin/gulp build
artifacts:
paths:
- build/
only:
- master
Testing:
stage: test
script:
- echo "Testing..."
#- npm test
only:
- master
Deploy:
stage: deploy
script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- rsync -avuz --delete --exclude=_ -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress $CI_PROJECT_DIR/build/ $DEPLOY_USER@$DEPLOY_SERVER:$DEPLOY_PATH
only:
- master
{
"name": "",
"version": "",
"description": "",
"main": "",
"license": "MIT",
"dependencies": {
"gulp": "^3.9.1"
},
"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-node": "^5.0.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment