[英]gitlab-ci file for an angular 6 project
我正在為我的項目使用 angular 6。 這是我的 .gitignore 文件內容:
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
由於node_modules文件夾沒有推送到git中,如何配置gitlab-ci文件進行自動部署?
如果使用以下命令安裝節點包:
npm install
然后您可以在構建腳本中使用相同的命令:
my_job:
before_script:
- npm install
script:
- my_script
如果您的工作是在可以訪問 Internet 並安裝了 npm 的運行程序上執行的,那么這應該可以工作。 根據部署過程的工作方式,您可以在 GitLab 中上傳artifacts
,也可以調用其他一些腳本來為您執行此操作。
您還可以使用 GitLab 中的緩存在構建之間重用 node_modules 文件夾, 示例如下:
image: node:latest
# Cache modules in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
before_script:
- npm install
test_async:
script:
- node ./specs/start.js ./specs/async.spec.js
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.