KAN-27 Unificando en un job monolitico por errores en builds anteriores #19
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
# This file was auto-generated by the Firebase CLI | |
# https://github.com/firebase/firebase-tools | |
name: Producction CI/CD | |
on: | |
push: | |
branches: | |
- devops # para testear, luego @TO-DO: cambiar a main | |
permissions: | |
checks: write | |
contents: read | |
pull-requests: write | |
jobs: | |
setup: | |
runs-on: potus | |
steps: | |
- uses: actions/checkout@v4 | |
build-client: | |
runs-on: potus | |
needs: setup | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup dependencias de client | |
working-directory: ./client | |
run: npm install | |
- name: Buildear client | |
working-directory: ./client | |
run: npm run build | |
env: | |
VITE_API_KEY: ${{ secrets.VITE_API_KEY }} | |
- name: Setup dependencias de admin | |
working-directory: ./admin | |
run: npm install | |
- name: Buildear admin | |
working-directory: ./admin | |
run: npm run build | |
- uses: lowply/deploy-firebase@v0.0.5 | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
FIREBASE_PROJECT: nms-devmaster | |
build-server: | |
runs-on: potus | |
permissions: | |
contents: read | |
packages: write | |
needs: setup | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image BACKEND | |
run: docker build -t ghcr.io/devmasters2-0/tp-inicial-laboratorio/nms-server:latest -f ./backend/Dockerfile-prod ./backend | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker image to GCR BACKEND | |
run: docker push ghcr.io/devmasters2-0/tp-inicial-laboratorio/nms-server:latest | |
deploy-server: | |
runs-on: lws01 | |
needs: build-server | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Quien soy | |
run: whoami | |
- name: Bajar servicio anterior Intento 1 | |
run: docker-compose -f docker-compose-prod.yml -p dm-nms down | |
- name: Bajar servicio anterior Intento 2 | |
run: docker-compose -f docker-compose-prod.yml -p dm-nms down | |
- name: Desplegar en LWS | |
env: | |
EMAIL_SMTP_USER: ${{ secrets.EMAIL_SMTP_USER }} | |
EMAIL_SMTP_PASSWORD: ${{ secrets.EMAIL_SMTP_PASSWORD }} | |
EMAIL_SMTP_SERVER: ${{ secrets.EMAIL_SMTP_SERVER }} | |
run: docker-compose -f docker-compose-prod.yml -p dm-nms up -d | |