Created
May 24, 2018 03:17
-
-
Save SherryQueen/3c879504e0b131fe1b5dbe59f0d70156 to your computer and use it in GitHub Desktop.
gitlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 镜像名 | |
| image: 'node:8.11.2-alpine' | |
| # 脚本运行 | |
| before_script: | |
| # 写入密钥 并配置 ~/.ssh/config 文件 | |
| - apk add --update openssh-client bash | |
| - eval $(ssh-agent -s) | |
| - bash -c "ssh-add <(echo '$SSH_PRIVATE_KEY')" | |
| - mkdir -p ~/.ssh | |
| - '[[ -f /.dockerenv ]] && echo -e "Host *\\n\\tStrictHostKeyChecking no\\n\\n" > ~/.ssh/config' | |
| # 安装依赖 | |
| - npm install | |
| # 缓存下载的依赖 | |
| cache: | |
| paths: | |
| - node_modules | |
| stages: | |
| - test | |
| - depoly | |
| # 部署到指定目录 | |
| depoly: | |
| stage: depoly | |
| script: | |
| # 编译代码 | |
| - npm run build | |
| # 部署代码 | |
| - scp -r build [email protected]:~ | |
| tags: | |
| - node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment