Automating deployment on PythonAnywhere
Closed this issue · 2 comments
We are currently have a .deploy.sh
script that is run manually on the server when new changes are to be deployed. It's not present on the repo. However it takes care of everything including pulling changes from GitHub, running migrations and building static files.
PythonAnywhere has this documentation on SSH access https://help.pythonanywhere.com/pages/SSHAccess/ if we are to remove the need to login to deploy new changes to the website.
Could this be a github action triggered by a release creation (maybe), that SSH into python anywhere's servers and runs the deploy script? I had something similar for a project once, so instead of automatically deploying when something gets merged to main
, we need to manually generate a new release that will trigger the deploy script on the server through this action.
It sounds like this action could be used; https://github.com/appleboy/ssh-action
The commands in the deploy script could then be added to the steps in the action. For example;
- name: deploy to 🐍anywhere
uses: appleboy/ssh-action@v0.1.7
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
whoami
ls -al