Skip to content

Continous Integration/Continuos Deployment #91

Continous Integration/Continuos Deployment

Continous Integration/Continuos Deployment #91

Workflow file for this run

name: Continous Integration/Continuos Deployment
on:
push:
branches:
- main
workflow_run:
workflows: ["continuous Training"]
branches: [main]
types:
- completed
workflow_dispatch:
inputs:
reason:
descriotion: Why to run this?
required: false
default: running CI/CD
jobs:
ci_cd:
runs-on: ubuntu-latest
env:
REGISTRY_NAME: ${{ secrets.REGISTRY_NAME }}
REGION: ${{ secrets.REGION }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
SERVICE_NAME: ${{ secrets.SERVICE_NAME }}
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Set Enviroment and bring the model
run: |
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install dvc[gs]
export GOOGLE_APPLICATION_CREDENTIALS=$(python utilities/setter.py)
dvc pull model/model.pkl.dvc -r model-tracker
- name: Set up GCLOUD SDK
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.SERVICE_ACCOUNT_KEY}}
project_id: ${{ secrets.PROJECT_ID }}
- name: Build and Push
run: |
docker build . -t $REGISTRY_NAME:$GITHUB_SHA
gcloud auth configure-docker -q
sudo -u $USER docker push $REGISTRY_NAME:$GITHUB_SHA
- name: Deploy to Cloud RUN
run: |
gcloud run services update $SERVICE_NAME --region=$REGION --image=$REGISTRY_NAME:$GITHUB_SHA