From 9d0665389a998e0e1fbe5972aff84c05e10e6d55 Mon Sep 17 00:00:00 2001 From: Guilherme Afonso Date: Mon, 26 Aug 2024 22:39:24 -0300 Subject: [PATCH] ci: add docker to github workflow --- .github/workflows/node.js.yml | 39 +++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a14e479..91f7248 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -2,9 +2,7 @@ name: Node.js CI on: push: - branches: ['main'] - pull_request: - branches: ['main'] + branches: ['ci/add-docker'] jobs: build: @@ -12,21 +10,40 @@ jobs: strategy: matrix: - node-version: [18.x] + node-version: [20.x] + steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: npm ci - - run: npm run build + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + deploy: needs: build runs-on: [self-hosted, Linux, X64, marquinhos] + steps: - - name: Make deploy.sh executable - run: chmod +x ./deploy.sh - - name: Execute deploy.sh - run: echo "${{ secrets.DVNS_CLUSTER_PASSWORD }}" | sudo -S ./deploy.sh "$(pwd)/dist" + - name: Stop Marquinhos + run: docker-compose down + + - name: Build and run Marquinhos + run: docker-compose up -d --build + + - name: Check status + run: | + if docker ps | grep -q marquinhosbot && docker ps | grep marquinhosbot | grep -q Up; then + echo "Marquinhos is running" + else + echo "Marquinhos is not running" + exit 1 + fi