I have an Amazon EC2 instance where i have setup NodeJS, PM2 and i have a script which when ran, pulls the code from Github (using deploy keys) and restarts PM2 with newest version.
Now i want to use github actions, and after a push is done against master, i want to ssh to the EC2 instance and run the script which pulls the code from Github and restarts PM2 with newest version.
Is it possible to do this? Since in order to SSH i need to use key/pair (PEM) file.
Since the repo is private, from security perspective does it make sense to include the PEM file in the github repo and use it?
If not, what would be the solution to that?
Thanks a lot in advance.
/deploy
or something, then set up a webhook to that URL and make it only trigger on certain GitHub events. - tadman