如何部署角度应用程序?

时间:2019-07-30 10:18:04

标签: bitbucket-pipelines

我的位桶中有两个分支

- master
- develop

Develop分支适用于我通过ng build --env=stg部署代码的地方。 Master是生产分支,我在其中通过ng build --prod

部署代码

我已经看过许多教程,但现在我迷失了方向。

这是我现阶段一直在写的内容。

有人可以帮助我吗?谢谢。

image: node:10.15.3

pipelines:
  branches:
    develop:
      - step:
        name: Build uat
        deployment: develop
        caches:
          - node
        script:
          - echo "Initiate develop branch"
          - npm install --qq
    master:
      - step:
          name: Build app
          deployment: production
          caches:
            - node
          script: # The script below will build the application.
            - echo "Master branch initiated"
            - npm install --qq
            - npm install -g @angular/cli
            - echo "Running Lint JS"
            - npm run lint
            - ng build --prod --build-optimizer --progress=false
            - echo "End of Master branch"
          artifacts:
            - dist/**
      - step:
          name: Deploy app
          script: # The script below will deploy the application to the webserver.
            - 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

0 个答案:

没有答案