Import data in production #1538
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: Import data in production | |
on: | |
repository_dispatch: | |
types: [import-data-production] | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: yarn install | |
run: yarn install | |
- name: Import GroupeParlementaire | |
run: yarn start -g | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_PRODUCTION }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_PRODUCTION }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_PROD }} | |
SUPABASE_ENV: Production | |
- name: Import Depute | |
run: yarn start -d | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_PRODUCTION }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_PRODUCTION }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_PROD }} | |
SUPABASE_ENV: Production | |
- name: Import Activite | |
run: yarn start -a | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_PRODUCTION }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_PRODUCTION }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_PROD }} | |
SUPABASE_ENV: Production | |
- name: Import OrganismeParlementaire | |
run: yarn start -o | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_PRODUCTION }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_PRODUCTION }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_PROD }} | |
SUPABASE_ENV: Production | |
- name: Import Deputes_OrganismeParlementaire | |
run: yarn start -p | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_PRODUCTION }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_PRODUCTION }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_PROD }} | |
SUPABASE_ENV: Production | |
- name: Upload logs as artifact | |
uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: logs | |
path: logs | |
- uses: 8398a7/action-slack@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: always() | |
with: | |
status: custom | |
fields: workflow,job,commit | |
custom_payload: | | |
{ | |
username: 'Github Actions', | |
icon_emoji: ':rocket:', | |
attachments: [ | |
{ | |
color: '${{ job.status }}' === 'success' ? '#28a745' : '${{ job.status }}' === 'failure' ? '#dc3545' : '#ffc107', | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": '${{ job.status }}' === 'success' ? "Data successfully imported in Supabase Production :sunglasses::tada:" : "Error while importing data in Supabase Production" | |
} | |
} | |
] | |
} | |
] | |
} |