Skip to content

Change python caching #270

Change python caching

Change python caching #270

name: test-and-deploy
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Run the tests first:
use-test:
uses: philgyford/pepysdiary/.github/workflows/test.yml@main
deploy:
needs: use-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
cd /webapps/pepys/code
git checkout .
git pull
source venv/bin/activate
pip-sync
./manage.py migrate
./manage.py collectstatic --noinput
./manage.py clear_cache
sudo systemctl restart gunicorn_pepys
- name: Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took # selectable (default: repo,message)
fields: repo,workflow,message,commit,action,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTIONS_CI_SLACK_HOOK }} # required
# Run even if job fails/cancelled, but only if Slack webhook is present (it's not when Dependabot runs):
if: ${{ always() && env.SLACK_WEBHOOK_URL != null }}