Madrugada de CI/CD (#18) #56
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: Staging CI/CD | |
on: | |
push: | |
branches: | |
- development | |
jobs: | |
setup: | |
runs-on: potus | |
steps: | |
# Paso 1: Checkout del repositorio | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
build-backend: | |
runs-on: potus | |
needs: setup | |
steps: | |
# Paso 2: Configurar Docker | |
- 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-dev:latest -f ./backend/Dockerfile-dev ./backend | |
build-admin: | |
runs-on: potus | |
needs: setup | |
steps: | |
# Paso 2: Configurar Docker | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
## Admin-Frontend | |
# Paso 6: Construir la imagen Docker especificando el subdirectorio del Dockerfile | |
- name: Build Docker image ADMIN | |
run: docker build -t ghcr.io/devmasters2-0/tp-inicial-laboratorio/nms-admin-dev:latest ./admin | |
build-client: | |
runs-on: potus | |
needs: setup | |
steps: | |
# Paso 2: Configurar Docker | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image CLIENT | |
run: docker build -t ghcr.io/devmasters2-0/tp-inicial-laboratorio/nms-client-dev:latest ./client | |
push-backend: | |
runs-on: potus | |
needs: build-backend | |
steps: | |
# Paso 3: Autenticar en GitHub Container Registry | |
- 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-dev:latest | |
push-admin: | |
runs-on: potus | |
needs: build-admin | |
steps: | |
# Paso 3: Autenticar en GitHub Container Registry | |
- 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 ADMIN | |
run: docker push ghcr.io/devmasters2-0/tp-inicial-laboratorio/nms-admin-dev:latest | |
push-client: | |
runs-on: potus | |
needs: build-client | |
steps: | |
# Paso 3: Autenticar en GitHub Container Registry | |
- 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 CLIENT | |
run: docker push ghcr.io/devmasters2-0/tp-inicial-laboratorio/nms-client-dev:latest | |
deploy: | |
runs-on: potus | |
needs: [push-backend, push-admin, push-client] | |
steps: | |
- name: Bajar servicio anterior Intento 1 | |
run: docker-compose -f docker-compose-dev.yml -p dm-nms down | |
- name: Bajar servicio anterior Intento 2 | |
run: docker-compose -f docker-compose-dev.yml -p dm-nms down | |
- name: Desplegar en PWS | |
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 |