Skip to content

lisijia6 submitted a CI CD Action #21

lisijia6 submitted a CI CD Action

lisijia6 submitted a CI CD Action #21

Workflow file for this run

name: Continuous Integration and Continuous Deployment
run-name: ${{ github.actor }} submitted a CI CD Action
on:
push:
branches: [ "main", "milestone6", "milestone6-yp", "milestone6-nl"]
jobs:
Explore-GitHub-Actions:
if: contains(github.event.head_commit.message, '/run-')
runs-on: ubuntu-latest
steps:
- run: echo "Comment ${{ github.event.head_commit.message }}"
- run: echo "Job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "Job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "Branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- id: 'auth'
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}'
- name: Configure Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Configure Docker Client
run: |-
gcloud auth configure-docker # --quiet #authenticate to gcr
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Build App Deploy Container
run: |-
cd ${{ github.workspace }}/src/app_deploy/
docker build -t app_deployment --platform=linux/amd64 -f Dockerfile .
- name: Run Deploy App
if: contains(github.event.head_commit.message, '/run-deploy-app')
run: |-
docker run --rm --name app_deployment \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/.ssh:/home/app/.ssh \
-v ${{ github.workspace }}/src/frontend:/frontend-react \
-v ${{ github.workspace }}/src/api-service:/api-service \
--volume $GITHUB_WORKSPACE:/workspace \
--mount type=bind,source=$GOOGLE_APPLICATION_CREDENTIALS,target=/secrets/deployment.json \
--env GOOGLE_APPLICATION_CREDENTIALS=/secrets/deployment.json \
-e USE_GKE_GCLOUD_AUTH_PLUGIN=True \
-e GCP_PROJECT=ac215project-398401 \
-e GCP_ZONE=us-west3-b \
app_deployment ./deploy-app.sh
- run: echo "Job's status is ${{ job.status }}."
- name: Run Data Processor
if: contains(github.event.head_commit.message, '/run-data-processor')
run: |-
docker run --rm --name app-deployment \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${{ github.workspace }}/src/frontend:/frontend-react \
-v ${{ github.workspace }}/src/api-service:/api-service \
-v ${{ github.workspace }}/src/data_processing:/data-processor \
--mount type=bind,source=$GOOGLE_APPLICATION_CREDENTIALS,target=/secrets/deployment.json \
-e GOOGLE_APPLICATION_CREDENTIALS=/secrets/deployment.json \
-e USE_GKE_GCLOUD_AUTH_PLUGIN=True \
-e GCP_PROJECT=ac215project-398401 \
-e GCP_ZONE=us-central1-a \
-e GCS_BUCKET_NAME=sciencetutor-app-models-demo2 \
-e GCS_SERVICE_ACCOUNT=ml-workflow@ac215project-398401.iam.gserviceaccount.com \
-e GCP_REGION=us-central1 \
-e GCS_PACKAGE_URI=gs://ac215-sciencetutor-trainer2 \
app_deployment ./run-data-processor.sh
- name: Run ML Pipeline
if: contains(github.event.head_commit.message, '/run-ml-pipeline')
run: |-
docker run --rm --name app-deployment \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${{ github.workspace }}/src/frontend:/frontend-react \
-v ${{ github.workspace }}/src/api-service:/api-service \
-v ${{ github.workspace }}/src/data_processing:/data-processor \
--mount type=bind,source=$GOOGLE_APPLICATION_CREDENTIALS,target=/secrets/deployment.json \
-e GOOGLE_APPLICATION_CREDENTIALS=/secrets/deployment.json \
-e USE_GKE_GCLOUD_AUTH_PLUGIN=True \
-e GCP_PROJECT=ac215project-398401 \
-e GCP_ZONE=us-central1-a \
-e GCS_BUCKET_NAME=sciencetutor-app-models-demo2 \
-e GCS_SERVICE_ACCOUNT=ml-workflow@ac215project-398401.iam.gserviceaccount.com \
-e GCP_REGION=us-central1 \
-e GCS_PACKAGE_URI=gs://ac215-sciencetutor-trainer2 \
app-deployment ./run-ml-pipeline.sh
- run: echo "Job's status is ${{ job.status }}."