Hi everyone,
I have been using a Pipeline to deploy my Angular (2+ with CLI) application to Heroku for some time and it has generally been working very. One of the things that is a little cumbersome, however, is that I have to run my 'npm run build' (which then runs the command: "ng build --prod --output-path=../dist/", check that in, merge it to my master branch and then have the pipeline run. Ideally, I could just use 'ng serve' in development, check in the changes, merge them to the master branch and have the Pipeline run the build command and then push the correct files.
I figured out how to have the pipeline run the build command, but then it does not push the proper files to Heroku, it pushes outdated files, not the ones it created. I am sure there is just something I fundamentally don't understand or missed.
I just recently added the "cd ../" in my most recent attempt, but it didn't do anything.
Do I have to do anything to pull the committed master branch but then the newly generated files, or to commit the newly generated files to the master branch?
All help is appreciated - below is my pipeline file:
image: node:8.9.4
clone:
depth: full
pipelines:
branches:
master:
- step:
script:
- npm install
- cd angular-src && npm install @angular-devkit/build-angular
- npm install @angular-devkit/build-optimizer
- npm install -g @angular/cli
- ng build --prod --output-path=../dist/
- cd ../
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master