Merge branch 'main' of https://github.com/Hufsthon2024Oeteco/FE #2
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: 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 lgtu deployments/oeteco-front |