I have a simple self hosted runner which runs on ubuntu ec2 machine.
part of my Yaml file
jobs:
development:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install dependencies
run: npm install
- name: Run test
run: npm run test
- name: change working directory
run: |
cd /usr/projects/dev
pwd
- name: re-deploying
run: |
npm install
sudo git pull origin development
sudo git reset --hard development
pm2 restart app
how ever the git HEAD stays at the last commit and don't see the the remote HEAD that's why I put
sudo git reset --hard development
but it doesn't work and I have to got to the machine and do it myself to reset the head and then restart the app with pm2
my question is, am i doing it wrongly? or is there another better way for redeploying?