A simple GitHub action that allows everyone to deploy to a remote server that's using PM2 easily
steps:
- uses: actions/checkout@v2
- name: Deploy to Staging
uses: Techie-Pi/node-vps-deployment@main
with:
remote-path: "~/deployment/staging"
host: 123.123.123.123
username: "ubuntu"
port: 2080
password: ${{ secrets.staging-password }}
pm2-id: "staging"
The action does the following:
- Copies the repository contents to the remote server on the specified folder
- Runs
npm ci
oryarn install
- Runs
pm2 restart <id>
with the provided ID/Name
remote-path
- Where do you want to copy the files to?host
- _What's the host IP address?username
- What's the username that you're going to login intoport
- What's the port of SSH? (default:22
)password
- What's the password of the user?`` (Note: in the future SSH Keys will be supported)automatic-pre-deploy
- Should deploy automatically (defaulttrue
)yarn
- Use yarn instead of npm (defaultfalse
)pm2-id
- What's the ID/Name of the PM2 application?
Note: Although sensitive information such as
password
is used through the input arguments, it's recommended to save it onSecrets