File "deploy-staging.yml"

Full Path: /home/tecassol/public_html/tecas-solar.ma/.github/workflows/deploy-staging.yml
File size: 1.29 KB
MIME-type: text/plain
Charset: utf-8

name: Deploy script

on:
  push:
    branches:
      - main
  workflow_dispatch:
    inputs:
      deploy:
        description: 'Deploy script'
        required: true
        default: 'true'

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: SSH Deploy to server
        uses: appleboy/ssh-action@v0.1.7
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          key: ${{ secrets.SSH_KEY }}
          port: ${{ secrets.PORT }}
          script: |
            set -e
            cd /home/digitonm/subdomains/tecas
            git reset --hard
            git pull -s recursive -X theirs https://abdelhamiderrahmouni:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/digiton-ma/tecas-solar.git main
            /usr/local/bin/ea-php83 ~/composer.phar install --no-interaction --prefer-dist --optimize-autoloader
            if [ ! -d "$HOME/.nvm" ]; then
            curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
            fi
            [ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"
            npm install
            npm run build
            /usr/local/bin/ea-php83 artisan cache:clear
            /usr/local/bin/ea-php83 artisan migrate --force