Skip to content

Commit

Permalink
streamline workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
guowei42 committed Nov 10, 2024
1 parent 0e1948e commit e705804
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 130 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/api-gateway-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: peerprep-cluster-1
GKE_ZONE: asia-southeast1
DEPLOYMENT_NAME: api-gateway
REPOSITORY_NAME: peerprep
SERVICE: api-gateway
IMAGE: gateway

jobs:
Expand All @@ -28,46 +28,46 @@ jobs:

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5
with:
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud auth configure-docker $GKE_ZONE-docker.pkg.dev --quiet
gcloud auth configure-docker ${GKE_ZONE}-docker.pkg.dev --quiet
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Build the Docker image
- name: Build
- name: 'Build and push Docker container'
run: |-
DOCKER_TAG="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:${GITHUB_SHA}"
DOCKER_TAG_LATEST="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:latest"
docker build \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA" \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
./api-gateway
--tag "${DOCKER_TAG}" \
--tag "${DOCKER_TAG_LATEST}" \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
./server/${SERVICE}
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA"
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest"
docker push "${DOCKER_TAG}"
docker push "${DOCKER_TAG_LATEST}"
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl apply -f kubernetes/api-gateway
kubectl rollout status deployment/$DEPLOYMENT_NAME
kubectl apply -f kubernetes/${SERVICE}
kubectl rollout status deployment/${SERVICE}
kubectl get services -o wide
36 changes: 18 additions & 18 deletions .github/workflows/deploy-ai-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: peerprep-cluster-1
GKE_ZONE: asia-southeast1
DEPLOYMENT_NAME: ai-service
REPOSITORY_NAME: peerprep
SERVICE: ai-service
IMAGE: ai

jobs:
Expand All @@ -28,46 +28,46 @@ jobs:

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5
with:
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud auth configure-docker $GKE_ZONE-docker.pkg.dev --quiet
gcloud auth configure-docker ${GKE_ZONE}-docker.pkg.dev --quiet
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Build the Docker image
- name: Build
- name: 'Build and push Docker container'
run: |-
DOCKER_TAG="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:${GITHUB_SHA}"
DOCKER_TAG_LATEST="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:latest"
docker build \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA" \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
./server/ai-service
--tag "${DOCKER_TAG}" \
--tag "${DOCKER_TAG_LATEST}" \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
./server/${SERVICE}
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA"
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest"
docker push "${DOCKER_TAG}"
docker push "${DOCKER_TAG_LATEST}"
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl apply -f kubernetes/ai-service
kubectl rollout status deployment/$DEPLOYMENT_NAME
kubectl apply -f kubernetes/${SERVICE}
kubectl rollout status deployment/${SERVICE}
kubectl get services -o wide
36 changes: 18 additions & 18 deletions .github/workflows/deploy-chat-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: peerprep-cluster-1
GKE_ZONE: asia-southeast1
DEPLOYMENT_NAME: chat-service
REPOSITORY_NAME: peerprep
SERVICE: chat-service
IMAGE: chat

jobs:
Expand All @@ -28,46 +28,46 @@ jobs:

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5
with:
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud auth configure-docker $GKE_ZONE-docker.pkg.dev --quiet
gcloud auth configure-docker ${GKE_ZONE}-docker.pkg.dev --quiet
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Build the Docker image
- name: Build
- name: 'Build and push Docker container'
run: |-
DOCKER_TAG="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:${GITHUB_SHA}"
DOCKER_TAG_LATEST="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:latest"
docker build \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA" \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
./server/chat-service
--tag "${DOCKER_TAG}" \
--tag "${DOCKER_TAG_LATEST}" \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
./server/${SERVICE}
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA"
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest"
docker push "${DOCKER_TAG}"
docker push "${DOCKER_TAG_LATEST}"
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl apply -f kubernetes/chat-service
kubectl rollout status deployment/$DEPLOYMENT_NAME
kubectl apply -f kubernetes/${SERVICE}
kubectl rollout status deployment/${SERVICE}
kubectl get services -o wide
36 changes: 18 additions & 18 deletions .github/workflows/deploy-collab-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: peerprep-cluster-1
GKE_ZONE: asia-southeast1
DEPLOYMENT_NAME: collab-service
REPOSITORY_NAME: peerprep
SERVICE: collab-service
IMAGE: collaboration

jobs:
Expand All @@ -28,46 +28,46 @@ jobs:

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5
with:
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud auth configure-docker $GKE_ZONE-docker.pkg.dev --quiet
gcloud auth configure-docker ${GKE_ZONE}-docker.pkg.dev --quiet
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Build the Docker image
- name: Build
- name: 'Build and push Docker container'
run: |-
DOCKER_TAG="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:${GITHUB_SHA}"
DOCKER_TAG_LATEST="${GKE_ZONE}-docker.pkg.dev/${PROJECT_ID}/${REPOSITORY_NAME}/${IMAGE}:latest"
docker build \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA" \
--tag "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
./server/collaboration-service
--tag "${DOCKER_TAG}" \
--tag "${DOCKER_TAG_LATEST}" \
--build-arg GITHUB_SHA="${GITHUB_SHA}" \
--build-arg GITHUB_REF="${GITHUB_REF}" \
./server/${SERVICE}
# Push the Docker image to Google Artifact Registry
- name: Publish
run: |-
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:$GITHUB_SHA"
docker push "$GKE_ZONE-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME/$IMAGE:latest"
docker push "${DOCKER_TAG}"
docker push "${DOCKER_TAG_LATEST}"
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl apply -f kubernetes/collab-service
kubectl rollout status deployment/$DEPLOYMENT_NAME
kubectl apply -f kubernetes/${SERVICE}
kubectl rollout status deployment/${SERVICE}
kubectl get services -o wide
8 changes: 4 additions & 4 deletions .github/workflows/deploy-matching-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: peerprep-cluster-1
GKE_ZONE: asia-southeast1
DEPLOYMENT_NAME: matching-redis
REPOSITORY_NAME: peerprep
SERVICE: matching-redis
IMAGE: redis

jobs:
Expand All @@ -26,7 +26,7 @@ jobs:

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}

Expand All @@ -45,11 +45,11 @@ jobs:
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
project_id: ${{ env.PROJECT_ID }}

# Deploy Redis to the GKE cluster
- name: Deploy Redis
run: |-
kubectl apply -f kubernetes/redis
kubectl rollout status deployment/$DEPLOYMENT_NAME
kubectl rollout status deployment/${SERVICE}
kubectl get services -o wide
Loading

0 comments on commit e705804

Please sign in to comment.