加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 17:32:20 所属栏目:安全 来源:网络整理
导读:我在我的Bitbucket存储库中启用了管道,我需要运行Angular 2构建并在每次构建后在我的服务器中部署dist文件夹(在执行构建命令后创建). 我在我的bitbucket-pipelines.yml文件中有以下内容: image: node:4.6.0pipelines: default: - step: script: # Modify th
我在我的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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读