- Setup SSH Server
in Manage Jenkins > Configure System
Checked Use password authentication, or use a different key
then type password or key. - Create FreeStyle project.
- In Source Code Management
select Git and insert Repository URL, Credential. - Build steps.
1. Add Execute shell and put below command
npm install
npm run build
2. Add Send files or execute commands over SSH
Create 2 sets of Transfers.
Step 1: remove all existing files.
Remote directory<project_name>
Exec command:rm -rf /var/www/html/<project_name>/*
Step 2: Transfer new files.
Source files:dist/**
Remove prefix:dist
Remote directory:<project_name>
Exec command:chmod -R 777 /var/www/html/<project_name>/*
- Apply and Build.