Merge pull request #857 from philgyford/dependabot/pip/sentry-sdk-2.14.0 #327
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/django-hines/.github/workflows/test.yml@main | |
deploy: | |
needs: use-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: ${{ secrets.DEPLOY_USERNAME }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: | | |
cd /webapps/hines/code | |
git checkout . | |
git pull | |
source venv/bin/activate | |
pip-sync | |
./manage.py migrate | |
./manage.py collectstatic --noinput | |
sudo systemctl restart gunicorn_hines | |
sudo systemctl restart djangoq_hines | |
- 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 }} |