Skip to content

Update offsets-db-data version #52

Update offsets-db-data version

Update offsets-db-data version #52

Workflow file for this run

name: Update DB
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
# Run the job every day at 12:00 AM UTC
- cron: '0 0 * * *'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-2
OFFSETS_DB_API_KEY_STAGING: ${{ secrets.OFFSETS_DB_API_KEY_STAGING }}
OFFSETS_DB_API_KEY_PRODUCTION: ${{ secrets.OFFSETS_DB_API_KEY_PRODUCTION }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
seed-db:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Current time in UTC in format YYYY-MM-DD HH:MM
if: always()
id: time
run: echo "::set-output name=date::$(date -u +'%Y-%m-%d %H:%M')"
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install fsspec requests s3fs pandas
- name: Seed Staging Database
run: |
python update_database.py staging https://offsets-db-staging.fly.dev/files
- name: Seed Production Database
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
run: |
python update_database.py production https://offsets-db.fly.dev/files
- name: Notify Slack on Failure
if: failure() && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
uses: slackapi/slack-github-action@v1.24.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: 'C06CXEYKMBP'
payload: |
{
"attachments": [
{
"color": "#ff0000",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Database Update Failure Alert 🚨"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*GH event:*\n${{ github.event_name }}"
},
{
"type": "mrkdwn",
"text": "*Time:*\n${{ steps.time.outputs.date }} UTC"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Details URL:*\n🔍 <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Workflow Run>"
}
]
}
]
}
]
}