-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
프론트엔드 cicd deploy.yml
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |