I'm trying to auto-deploy changes in Django project using GitHub Actions. There is a problem with restarting services. It says:
Failed to restart gunicorn/nginx.service: Interactive authentication required.
How can I make it work?
This is the deploy.yml
name: deploying changes
on:
push:
branches: [staging]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: deploying changes
uses: appleboy/ssh-action@master
with:
host: xxx.xx.xx.xxx
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd proj/
sh deploy.sh
deploy.sh
# Cd into the required directory
cd proj/
# Pull the changes
git pull
python manage.py migrate
# Collectstatic
python manage.py collectstatic --noinput
# Restart gunicorn and reload nginx
service gunicorn restart
service nginx restart