Skip to content

Tax Calculator Node CI/CD to AWS EKS #1

Tax Calculator Node CI/CD to AWS EKS

Tax Calculator Node CI/CD to AWS EKS #1

name: Tax Calculator Node CI/CD to AWS EKS
on:
# push
workflow_dispatch
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
service: [service-a, service-b]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '25'
- name: Install Dependencies
working-directory: docker/app2-tax-calculator/python/${{ matrix.service }}
run: npm ci
- name: Run Tests (If any)
working-directory: docker/app2-tax-calculator/python/${{ matrix.service }}
run: npm test --if-present
docker-build-push:
runs-on: ubuntu-latest
needs: build-test
strategy:
matrix:
service:
- { name: "service-a", docker_name: "tax-service-a", path: "docker/app2-tax-calculator/node/service-a"}
- { name: "service-b", docker_name: "tax-service-b", path: "docker/app2-tax-calculator/node/service-b"}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.service.path }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ matrix.service.docker_name }}:node-latest
deploy-aws-eks:
runs-on: ubuntu-latest
needs: docker-build-push
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5.1.1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-south-1
- name: Setup kubectl
uses: azure/setup-kubectl@v4
- name: Update kubeconfig for EKS
run: |
aws eks update-kubeconfig --name hello-cluster --region ap-south-1
- name: Verify connection
run: kubectl get nodes
- name: Deploy to AWS (Kubernetes)
run: |
kubectl apply -f k8s/aws/app2-tax-calculator/service-a
kubectl apply -f k8s/aws/app2-tax-calculator/service-b