angular – 使用Pipelines将文件夹从Bitbucket repo推送到公共服务器

前端之家收集整理的这篇文章主要介绍了angular – 使用Pipelines将文件夹从Bitbucket repo推送到公共服务器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的Bitbucket存储库中启用了管道,我需要运行Angular 2构建并在每次构建后在我的服务器中部署dist文件夹(在执行构建命令后创建).

我在我的bitbucket-pipelines.yml文件中有以下内容

image: node:4.6.0

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - npm install
          - npm run build:prod

我在互联网上找到了这段代码

- apt-get update
- apt-get -qq install git-ftp
- git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://123.456.789.123/timount/angular_app

我使用pem文件通过SSH客户端登录我的服务器.那么上面的代码片段有用吗?如果没有,我如何在上面的命令中使用pem文件

为了更清楚,npm run build:prod命令实际上创建了dist文件夹,需要在上述位置的服务器上部署.我怎样才能做到这一点?

解决方法

1.在bitbucket-pipelines.yml中写下这个

image: node:8.7.0
pipelines:
  default:
    - step:
        name: Installation
        caches:
          - node
        script:
          - npm install
    - step:
        name: Building
        script:
          - npm install -g @angular/cli #need to install angular-cli to make build
          - npm run build --aot
    - step:
        name: Deployment
        script:
          - apt-get update
          - apt-get install ncftp
          - ncftpput -v -u "$FTP_USERNAME" -p "$FTP_PASSWORD" -R $FTP_HOST $FTP_SITE_ROOT dist/*
          - echo Finished uploading /dist files to $FTP_HOST$FTP_SITE_ROOT

2.配置bitbucket环境变量

enter image description here

猜你在找的Angularjs相关文章