Skip to content

Commit

Permalink
Update run-tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
realgoob authored Sep 27, 2024
1 parent f00e991 commit 3393525
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: CI/CD Pipeline
name: Test-Build-Deploy Pipeline

on:
push:
branches:
- session-1
- session-2
pull_request:
branches:
- session-3
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -53,3 +48,26 @@ jobs:
context: .
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tech-trek:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs: build_and_push
steps:
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ secrets.DOCKER_HUB_USERNAME }}-tech-trek
image: docker.io/${{ secrets.DOCKER_HUB_USERNAME }}/tech-trek:${{ github.sha }}
region: us-central1
flags: "--allow-unauthenticated"

- name: Get Cloud Run Service URL
run: |
URL=$(gcloud run services describe "${{ secrets.DOCKER_HUB_USERNAME }}-tech-trek" --region us-central1 --format 'value(status.url)')
echo "Cloud Run service URL: $URL"
echo "SERVICE_URL=$URL" >> $GITHUB_ENV

0 comments on commit 3393525

Please sign in to comment.