Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Django

Django #30

name: Django
on:
schedule:
- cron: '46 22 * * *'
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Django-AMD64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image Django
run: docker-compose -f "docker-compose.yml" up -d --build
- name: Web site test
run: |
# sh /home/ubuntu/script/curl-check.sh url "http://localhost:35399" stack-name "Django"
#curl -i http://localhost:35399
# - name: Destroy container and file
# run: |
# docker-compose down
# echo "y" | docker image prune -a
# sudo rm -rf /tmp/django/
- name: notify slack
id: slack
uses: slackapi/slack-github-action@v1.24.0
# https://api.slack.com/apps/<your-app-id>/incoming-webhooks
if: ${{ SUCCESS() }}
with:
channel-id: '#github_action_status' # slack channel #alerts-test
payload: |
{
"text": "GitHub Action failed",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Production deployment check failed* :fire_engine:\n High error rate detected after deployment! Rolling back..."
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":github: Failed action"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":grafana: Grafana dashboard"
},
"url": "https://hooks.slack.com/services/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"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_FAIL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK