Issue
how could I execute a npm install and ng build commnad line after a git push trought Jenkins? Please condiser that i am using BitBucket as a remote repository.
thanks in advance. Andrea
Solution
Please follow below steps to setup npm install and auto build via Jenkins.
- Login to your jenkins account
- Click on New Item from left menu and Select Freestyle project and set project name as per your requirement.
- After That on Configure screen set your git repository project link.
- Then next option is custom repository and set your custom server path into that.
- In Source Code Management click on Git and set Project link and credentials.
- Set which branch would you like to use for build.
- If want to run this configuration on daily basis then check Poll SCM and set time.
- Then go to Build Management and select Execute Shell option and setup below commands in proper way.
- npm install
- ng build --no-aot --no-build-optimizer --base-href ./
- cp -R CUSTOM PATH(path to your custom repository where build is stored/dist/*) SOURCE PATH(path to your source repository where project is run) (Here you have to set your project path)
Please find below screen shot for better understanding
Answered By - Kaushik Andani