Tax Calculator Frontend CI/CD to AWS EKS #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tax Calculator Frontend CI/CD to AWS EKS | |
| on: | |
| # push | |
| workflow_dispatch | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Create .env for Build | |
| working-directory: docker/app2-tax-calculator/tax-calculator-frontend | |
| run: echo "VITE_API_URL=/api" > .env | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '25' | |
| - name: Install Dependencies | |
| working-directory: docker/app2-tax-calculator/tax-calculator-frontend | |
| run: npm ci | |
| - name: Run Tests | |
| working-directory: docker/app2-tax-calculator/tax-calculator-frontend | |
| run: npm test --if-present | |
| - name: Build Frontend | |
| working-directory: docker/app2-tax-calculator/tax-calculator-frontend | |
| run: npm run build | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| needs: build-test | |
| 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: Create .env for Build | |
| working-directory: docker/app2-tax-calculator/tax-calculator-frontend | |
| run: echo "VITE_API_URL=/api" > .env | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: docker/app2-tax-calculator/tax-calculator-frontend | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKER_USERNAME }}/tax-calculator-frontend: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/frontend | |
| kubectl apply -f k8s/aws/app2-tax-calculator/ingres.yaml | |