Skip to content

Continuous Deployment for User Service #13

Continuous Deployment for User Service

Continuous Deployment for User Service #13

Workflow file for this run

name: Continuous Deployment for User Service
on:
workflow_run:
workflows: ["Continuous Integration for Comment Service"]
types:
- completed
env:
PROJECT_ID: gke-project-423206
CLUSTER_NAME: autopilot-cluster-1
ZONE: us-central1
jobs:
deploy:
name: Deploy to GKE Autopilot
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
- name: Build the application
run: |
mvn clean
mvn -B package --file pom.xml
- name: Authenticate
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Configure gcloud
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.PROJECT_ID }}
install_components: 'gke-gcloud-auth-plugin'
- name: Set cluster context
run: |
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --zone ${{ env.ZONE }} --project ${{ env.PROJECT_ID }}
- name: Apply Kubernetes manifests
run: |
kubectl apply -f resources.yaml
notifications:
needs: deploy
uses: ./.github/workflows/notifyCD.yaml
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}}