69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
|
|
name: Node.js CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [18.x, 20.x, 22.x]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
|
|
|
|
steps:
|
|
- name: Test Summary
|
|
uses: test-summary/action@v2
|
|
with:
|
|
paths: "test/results/**/TEST-*.xml"
|
|
output: test-summary.md
|
|
if: always()
|
|
|
|
- name: Use checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
- run: npm ci
|
|
- run: npm run build --if-present
|
|
- run: npm test
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: Tonis-Mac-mini
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
|
|
steps:
|
|
- name: PM2 Deployment
|
|
# You may pin to the exact commit or the version.
|
|
# uses: victorargento/pm2-deployment@9f1857537a23be1e6eb173bc5394a49c6e3e3e1a
|
|
uses: victorargento/pm2-deployment@0.1
|
|
with:
|
|
#
|
|
build: true # optional, default is false
|
|
# Remote host
|
|
host: 192.168.1.102
|
|
# Username to login
|
|
username: root
|
|
# SSH port
|
|
port: 22
|
|
# SSH password
|
|
# Removed direct password input for security, using environment variable instead
|
|
with:
|
|
DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
|
|
# Remote path where the files are going to be copied
|
|
remote-path: /home/zouklambadabcn.com/public_html
|
|
# PM2 ID or Name of the process
|
|
pm2-id: ZLB
|