Skip to content

Get Match

Get Match #377

Workflow file for this run

name: Get Match
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'
jobs:
insert_database:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Matches
run: |
npx --yes api-sport-cli get-matchs -c .github/configApiSport/football.json -s matchs.football.sql -j matchs.football.json -u api_id
npx --yes api-sport-cli get-matchs -c .github/configApiSport/default.json -s matchs.sql -j matchs.json -u api_id
env:
SPORT_API_KEY: ${{ secrets.SPORT_API_KEY }}
- uses: actions/upload-artifact@v4
with:
name: matchs
path: |
matchs.football.json
matchs.football.sql
matchs.json
matchs.sql
- name: Install Postgres 15
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-15
- name: Add matchs.sql to database Staging
run: |
psql -h "$HOST" -p 5432 -d postgres -U "postgres.$STAGING_PROJECT_ID" -f matchs.football.sql
psql -h "$HOST" -p 5432 -d postgres -U "postgres.$STAGING_PROJECT_ID" -f matchs.sql
env:
PGPASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
HOST: ${{ secrets.STAGING_HOST }}
STAGING_PROJECT_ID: ${{ secrets.STAGING_PROJECT_ID }}
- name: Add matchs.sql to database Prod
run: |
psql -h "$HOST" -p 5432 -d postgres -U "postgres.$PRODUCTION_PROJECT_ID" -f matchs.football.sql
psql -h "$HOST" -p 5432 -d postgres -U "postgres.$PRODUCTION_PROJECT_ID" -f matchs.sql
env:
PGPASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
HOST: ${{ secrets.PRODUCTION_HOST }}
PRODUCTION_PROJECT_ID: ${{ secrets.PRODUCTION_PROJECT_ID }}