name: GBCI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    runs-on: gbo
    
    steps:
    - name: Disable SSL verification (temporary)
      run: git config --global http.sslVerify false

    - uses: actions/checkout@v4

    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20'
        cache: 'npm'

    - name: Install dependencies and build
      run: |
        npm i 
        npm run build

    - name: Deploy to production
      run: |
        sudo rm -rf /opt/gbo/websites/gb6.pragmatismo.com.br/*
        sudo cp -r ./out/. /opt/gbo/websites/gb6.pragmatismo.com.br/