Skip to content

πŸ”§ Nginx μ„€μ • μˆ˜μ • #45

πŸ”§ Nginx μ„€μ • μˆ˜μ •

πŸ”§ Nginx μ„€μ • μˆ˜μ • #45

Workflow file for this run

name: Frontend CI/CD
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Create .env file
run: |
echo "${{ secrets.ENV_FILE }}" > .env
- name: Install dependencies
run: yarn install
- name: Build project
run: yarn build
- name: Log in to Docker Hub
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/hanalink-react:latest .
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/hanalink-react:latest
- name: Configure AWS credentials
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Set up kubectl
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 --decode > $HOME/.kube/config
- name: Delete old pods
run: kubectl delete pods -l app=new-hanalink-react-app
- name: Deploy to Kubernetes
run: |
kubectl set image deployment/new-hanalink-react-app new-hanalink-react-app=${{ secrets.DOCKER_USERNAME }}/hanalink-react:latest