Skip to content

Commit

Permalink
add deploy workflow for all services
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnumohanan404 committed May 14, 2024
1 parent 8a4ad1a commit b6e97bb
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy-client

on:
push:
branches:
- main
paths:
- 'client/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd client && docker build -t vishnumohanan/client .
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- run: docker push vishnumohanan/client

- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "latest"
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Install gke-gcloud-auth-plugin
run: gcloud components install gke-gcloud-auth-plugin

- name: Configure kubectl
run: gcloud container clusters get-credentials ${{secrets.GKE_CLUSTER_NAME}} --region=${{secrets.GKE_REGION}} --project=${{ secrets.GKE_PROJECT_ID }}
- run: kubectl rollout restart deployment client-depl

36 changes: 36 additions & 0 deletions .github/workflows/deploy-expiration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy-expiration

on:
push:
branches:
- main
paths:
- 'expiration/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd expiration && docker build -t vishnumohanan/expiration .
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- run: docker push vishnumohanan/expiration

- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "latest"
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Install gke-gcloud-auth-plugin
run: gcloud components install gke-gcloud-auth-plugin

- name: Configure kubectl
run: gcloud container clusters get-credentials ${{secrets.GKE_CLUSTER_NAME}} --region=${{secrets.GKE_REGION}} --project=${{ secrets.GKE_PROJECT_ID }}
- run: kubectl rollout restart deployment expiration-depl

36 changes: 36 additions & 0 deletions .github/workflows/deploy-orders.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy-orders

on:
push:
branches:
- main
paths:
- 'orders/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd orders && docker build -t vishnumohanan/orders .
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- run: docker push vishnumohanan/orders

- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "latest"
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Install gke-gcloud-auth-plugin
run: gcloud components install gke-gcloud-auth-plugin

- name: Configure kubectl
run: gcloud container clusters get-credentials ${{secrets.GKE_CLUSTER_NAME}} --region=${{secrets.GKE_REGION}} --project=${{ secrets.GKE_PROJECT_ID }}
- run: kubectl rollout restart deployment orders-depl

36 changes: 36 additions & 0 deletions .github/workflows/deploy-payments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy-payments

on:
push:
branches:
- main
paths:
- 'payments/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd payments && docker build -t vishnumohanan/payments .
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- run: docker push vishnumohanan/payments

- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "latest"
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Install gke-gcloud-auth-plugin
run: gcloud components install gke-gcloud-auth-plugin

- name: Configure kubectl
run: gcloud container clusters get-credentials ${{secrets.GKE_CLUSTER_NAME}} --region=${{secrets.GKE_REGION}} --project=${{ secrets.GKE_PROJECT_ID }}
- run: kubectl rollout restart deployment payments-depl

37 changes: 37 additions & 0 deletions .github/workflows/deploy-tickets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

name: deploy-tickets

on:
push:
branches:
- main
paths:
- 'tickets/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd tickets && docker build -t vishnumohanan/tickets .
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
- run: docker push vishnumohanan/tickets

- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GKE_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: "latest"
project_id: ${{ secrets.GKE_PROJECT_ID }}
- name: Install gke-gcloud-auth-plugin
run: gcloud components install gke-gcloud-auth-plugin

- name: Configure kubectl
run: gcloud container clusters get-credentials ${{secrets.GKE_CLUSTER_NAME}} --region=${{secrets.GKE_REGION}} --project=${{ secrets.GKE_PROJECT_ID }}
- run: kubectl rollout restart deployment tickets-depl

0 comments on commit b6e97bb

Please sign in to comment.