Import data in staging #1276
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 staging | |
on: | |
repository_dispatch: | |
types: [import-data-staging] | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: develop | |
- 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_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Import Depute | |
run: yarn start -d | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Import Activite | |
run: yarn start -a | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Import OrganismeParlementaire | |
run: yarn start -o | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Import Deputes_OrganismeParlementaire | |
run: yarn start -p | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Import Ministeres | |
run: yarn start -s | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Import Ministres | |
run: yarn start -m | |
env: | |
SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }} | |
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY_STAGING }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_NOTIFICATION: ${{ secrets.SLACK_NOTIFICATION }} | |
NOSDEPUTES_BASE_URL: ${{ secrets.NOSDEPUTES_BASE_URL_STAGING }} | |
SUPABASE_ENV: Staging | |
- name: Upload logs as artifact | |
uses: actions/upload-artifact@v3 | |
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 Staging :sunglasses::tada:" : "Error while importing data in Supabase Staging" | |
} | |
} | |
] | |
} | |
] | |
} |