I have pipelines enabled in my Bitbucket repository and I need to run Angular 2 build and deploy the dist folder (which gets created after the build command is executed) in my server after every build.
I have following in my bitbucket-pipelines.yml file:
image: node:4.6.0
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- npm install
- npm run build:prod
I found this code snippet on the Internet:
- 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
I use a pem file to login to my server through the SSH client. So is the above code snippet useful? If not, how can I use the pem file in the above command?
To make it more clear, npm run build:prod command actually creates the dist folder, which needs to be deployed on the server at the above location. How can I achieve this?
1. Write this in 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_ROOT2. Configure your bitbucket environment variables