feat: 배포용 수정 #3
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
name: Deploy Vite React App to k3s | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm install | |
- name: Copy .env file | |
run: echo "${{ secrets.ENV_FILE }}" > .env | |
- name: Build the Vite app | |
run: npm run build | |
- name: Build Docker image | |
run: docker build -t ${{ secrets.DOCKER_REGISTRY }}/oeteco_front:latest . | |
- name: Push Docker image | |
run: docker push ${{ secrets.DOCKER_REGISTRY }}/oeteco_front:latest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Set up KUBECONFIG | |
run: | | |
mkdir $HOME/.kube | |
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config | |
- name: Install kubectl | |
uses: azure/setup-kubectl@v3 | |
with: | |
version: 'latest' | |
- name: Rollout restart the deployment | |
run: | | |
kubectl rollout restart -n oeteco deployments/oeteco-front |