Skip to content

Commit

Permalink
Merge pull request #5 from Killpit/master
Browse files Browse the repository at this point in the history
Add 6 CI/CD pipelines for microservices
  • Loading branch information
iam-veeramalla authored May 6, 2024
2 parents 687a876 + b1b27e6 commit 7ae6c9a
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/cart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Cart

on:
push:
branches:
- master
paths:
- '**.js' # Only trigger on changes to Python files (**.py)
- '.github/workflows/cart.yaml' # Include workflow file changes

pull_request:
branches:
- master
paths:
- '**.js' # Only trigger on changes to Python files (**.py)
- '.github/workflows/cart.yaml' # Include workflow file changes

jobs:
payment:
name: Build and deploy cart microservice
runs-on: [self-hosted] # Use a standard runner instead of self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: NPM install
run: npm install

- name: Build Docker image
run: |
docker build -t cart . # Build image tagged as 'payment' from current directory
- name: Docker Login (use secrets)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Push
run: |
docker tag cart ${name}/cart:latest
docker push ${name}/cart:latest
42 changes: 42 additions & 0 deletions .github/workflows/catalogue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Catalogue

on:
push:
branches:
- master
paths:
- '**.js' # Only trigger on changes to Python files (**.py)
- '.github/workflows/catalogue.yaml' # Include workflow file changes

pull_request:
branches:
- master
paths:
- '**.js' # Only trigger on changes to Python files (**.py)
- '.github/workflows/catalogue.yaml' # Include workflow file changes

jobs:
payment:
name: Build and deploy catalogue microservice
runs-on: [self-hosted] # Use a standard runner instead of self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: NPM install
run: npm install

- name: Build Docker image
run: |
docker build -t catalogue . # Build image tagged as 'payment' from current directory
- name: Docker Login (use secrets)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Push
run: |
docker tag catalogue ${name}/catalogue:latest
docker catalogue ${name}/catalogue:latest
44 changes: 44 additions & 0 deletions .github/workflows/dispatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Dispatch

on:
push:
branches:
- master
paths:
- '**.go' # Only trigger on changes to Python files (**.py)
- '.github/workflows/dispatch.yaml' # Include workflow file changes

pull_request:
branches:
- master
paths:
- '**.go' # Only trigger on changes to Python files (**.py)
- '.github/workflows/dispatch.yaml' # Include workflow file changes

jobs:
payment:
name: Build and deploy dispatch microservice
runs-on: [self-hosted] # Use a standard runner instead of self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Go install
run: |
curl -sL https://dl.google.com/go/go1.18.linux-amd64.tar.gz |
export PATH=$PATH:/home/runner/go/bin
- name: Build Docker image
run: |
docker build -t payment . # Build image tagged as 'payment' from current directory
- name: Docker Login (use secrets)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Push
run: |
docker tag dispatch ${name}/dispatch:latest
docker push ${name}/dispatch:latest
42 changes: 42 additions & 0 deletions .github/workflows/payment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Payment

on:
push:
branches:
- master
paths:
- '**.py' # Only trigger on changes to Python files (**.py)
- '.github/workflows/payment.yaml' # Include workflow file changes

pull_request:
branches:
- master
paths:
- '**.py' # Only trigger on changes to Python files (**.py)
- '.github/workflows/payment.yaml' # Include workflow file changes

jobs:
payment:
name: Build and deploy payment microservice
runs-on: [self-hosted] # Use a standard runner instead of self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Python install
run: sudo apt-get install python3

- name: Build Docker image
run: |
docker build -t payment . # Build image tagged as 'payment' from current directory
- name: Docker Login (use secrets)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Push
run: |
docker tag payment ${name}/payment:latest
docker push ${name}/payment:latest
44 changes: 44 additions & 0 deletions .github/workflows/shipping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Dispatch

on:
push:
branches:
- master
paths:
- '**.java' # Only trigger on changes to Python files (**.py)
- '.github/workflows/shipping.yaml' # Include workflow file changes

pull_request:
branches:
- master
paths:
- '**.java' # Only trigger on changes to Python files (**.py)
- '.github/workflows/shipping.yaml' # Include workflow file changes

jobs:
payment:
name: Build and deploy shipping microservice
runs-on: [self-hosted] # Use a standard runner instead of self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Go install
run: |
sudo apt-get install openjdk 17 |
java -version
- name: Build Docker image
run: |
docker build -t shipping .
- name: Docker Login (use secrets)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Push
run: |
docker tag shipping ${name}/shipping:latest
docker push ${name}/shipping:latest
42 changes: 42 additions & 0 deletions .github/workflows/user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: User

on:
push:
branches:
- master
paths:
- '**.js' # Only trigger on changes to Python files (**.py)
- '.github/workflows/user.yaml' # Include workflow file changes

pull_request:
branches:
- master
paths:
- '**.js' # Only trigger on changes to Python files (**.py)
- '.github/workflows/user.yaml' # Include workflow file changes

jobs:
payment:
name: Build and deploy user microservice
runs-on: [self-hosted] # Use a standard runner instead of self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: NPM install
run: npm install

- name: Build Docker image
run: |
docker build -t user . # Build image tagged as 'payment' from current directory
- name: Docker Login (use secrets)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker Push
run: |
docker tag user ${name}/user:latest
docker user ${name}/user:latest

0 comments on commit 7ae6c9a

Please sign in to comment.