KAN-27 Fix checkout on prod api server y nueva action de firebase deploy #14
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 | |
build-admin: | |
runs-on: potus | |
needs: setup | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Setup dependencias de admin | |
working-directory: ./admin | |
run: npm install | |
- name: Buildear admin | |
working-directory: ./admin | |
run: npm run build | |
deploy-client: | |
runs-on: potus | |
needs: build-client | |
steps: | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" | |
projectId: nms-devmaster | |
channelId: live | |
target: web-client | |
deploy-admin: | |
runs-on: potus | |
needs: build-admin | |
steps: | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" | |
projectId: nms-devmaster | |
channelId: live | |
target: web-admin | |
build-server: | |
runs-on: potus | |
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 | |
deploy-server: | |
runs-on: lws01 | |
needs: build-server | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bajar servicio anterior Intento 1 | |
run: docker-compose -f docker-compose.yml -p dm-nms down | |
- name: Bajar servicio anterior Intento 2 | |
run: docker-compose -f docker-compose.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 }} | |
TEST: "true" | |
run: docker-compose -f docker-compose-dev.yml -p dm-nms up -d |