Skip to content

Commit

Permalink
Create deploy.yml
Browse files Browse the repository at this point in the history
프론트엔드 cicd deploy.yml
  • Loading branch information
tlsaudwl authored Jul 3, 2024
1 parent 2e58083 commit 593a4f2
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Frontend CI/CD

on:
push:
branches:
- dev

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: yarn install

- name: Build the 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: Set up kubectl
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 --decode > $HOME/.kube/config
env:
KUBECONFIG: $HOME/.kube/config

- name: Delete old pods
run: kubectl delete pods -l app=hanalink-react-app
env:
KUBECONFIG: $HOME/.kube/config

- name: Deploy to Kubernetes
run: |
kubectl set image deployment/hanalink-react-app hanalink-react-app=${{ secrets.DOCKER_USERNAME }}/hanalink-react:latest
env:
KUBECONFIG: $HOME/.kube/config

0 comments on commit 593a4f2

Please sign in to comment.