1.Prepare a deployed server, see more
- Install NodeJS and Git corresponding to current OS
- Use NodeJS to run this repo with below config
- modify
port
,secret
,dataPath
onconfig.js
- verify the operation with a sample repo
2.Add a repo to 'push-to-deploy', see more
- Add a Web Hook on the Setting of this repo and verify
- Add new repository setting on
config.js
on deployed server - verify the deployed folder exists after pushed
- Set up IIS website on Windows
- Set up Nginx, Apache, ... on Linux
How to setup config.js
:
module.exports = {
host: '0.0.0.0',
port: 4567,
hookPath: '/web-hook',
secret: 'bay gio da biet',
dataPath: 'websites',
repositories: {
'testGhPages': {
repositoryUrl: 'https://github.com/nemesisqp/test-gh2.git',
branch: 'gh-pages',
dataPath: 'otherPath' // optional
}
}
};
- Open port 4567 (or your own port) on Deployed Server
- Windows: open on Firewall
- Ubuntu:
sudo ufw allow 4567/tcp
,sudo ufw enable
- Edit common fields
secret
value to pair between Deployed Server và Git Server (github, gitlab,...)dataPath
: path to save deployed source
- Add new setting to
repositories
, e.g
'testOtherBranch': {
repositoryUrl: 'https://github.com/nemesisqp/test-gh2.git',
branch: 'otherBranch'
}