Get Match #51
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: Get Match | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
insert_database: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
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 "db.$STAGING_PROJECT_ID.supabase.co" -p 5432 -d postgres -U postgres -f matchs.football.sql | |
psql -h "db.$STAGING_PROJECT_ID.supabase.co" -p 5432 -d postgres -U postgres -f matchs.sql | |
env: | |
PGPASSWORD: ${{ secrets.STAGING_DB_PASSWORD }} | |
STAGING_PROJECT_ID: ${{ secrets.STAGING_PROJECT_ID }} | |
- name: Add matchs.sql to database Prod | |
run: | | |
psql -h "db.$PRODUCTION_PROJECT_ID.supabase.co" -p 5432 -d postgres -U postgres -f matchs.football.sql | |
psql -h "db.$PRODUCTION_PROJECT_ID.supabase.co" -p 5432 -d postgres -U postgres -f matchs.sql | |
env: | |
PGPASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }} | |
PRODUCTION_PROJECT_ID: ${{ secrets.PRODUCTION_PROJECT_ID }} |