Skip to content

Update test.csv

Update test.csv #76

Workflow file for this run

on:
workflow_dispatch:
inputs:
manual_run:
description: 'Manually trigger the workflow'
default: ''
schedule:
- cron: '0 0 */15 * *'
push:
branches:
- main
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
IMAGE_NAME: retailsensei
REGION: asia-southeast1
GIT_TAG: v0.1
jobs:
Build-push-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Authenticate with Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Use gcloud CLI
run: gcloud info
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run data pipeline - FRED API to Cloud SQL
env:
FRED_API_KEY: ${{ secrets.FRED_API_KEY }}
INSTANCE_CONNECTION_NAME: ${{ secrets.INSTANCE_CONNECTION_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
run: |
python fred_to_db.py
- name: Run data pipeline - Cloud SQL to CSV
env:
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
INSTANCE_CONNECTION_NAME: ${{ secrets.INSTANCE_CONNECTION_NAME }}
run: |
python db_to_artifacts.py
- name: Commit artifacts generated by python db_to_artifacts.py
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add artifacts/
git diff-index --quiet HEAD || (git commit -a -m "Add artifacts" --allow-empty --no-verify)
- name: Push artifacts to the main branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Authorize Docker push
run: gcloud auth configure-docker --quiet
- name: Build and tag image
run: |-
docker build . --tag "gcr.io/$PROJECT_ID/$IMAGE_NAME:$GIT_TAG"
- name: Push Docker image to GCR
run: |-
docker push gcr.io/$PROJECT_ID/$IMAGE_NAME:$GIT_TAG
- name: Deploy
run: |-
gcloud run deploy $IMAGE_NAME --image gcr.io/$PROJECT_ID/$IMAGE_NAME:$GIT_TAG \
--project $PROJECT_ID \
--platform managed \
--region $REGION \
--allow-unauthenticated \
--quiet