name: Gitea Actions
run-name: ${{ gitea.actor }} is testing out Gitea Actions ??
on: [push]

jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    name: Build and deploy
    steps:
      - name: Migrate env file
        run: | 
          echo "${{ secrets.ENVIRONMENT }}" > ./.env
          cat ./.env
      - name: Install Yarn
        run: npm install -g yarn    
      - name: Install Node
        uses: actions/setup-node@v4
        with:
          node-version: 18
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.2'
          extensions: curl, exif, fileinfo, mbstring, mysqli, mysqlnd, openssl, PDO, pdo_mysql  
      - name: Update npm dependencies
        run: | 
          node -v
          npm i --progress=false
      - name: Update composer dependencies
        uses: php-actions/composer@v6
        with:
            command:
              composer install
      - name: Build frontend
        run: npm run build
      - name: Deploy to Server
        run: echo "Eto ewe v razrabotke"
        # uses: https://gitea.com/aquelle1/ssh-deploy@main
        #env:
        #  SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
        #  ARGS: "-rlgoDzvc -i --delete"  
        #  REMOTE_HOST: ${{ secrets.SSH_HOST }}
        #  REMOTE_USER: ${{ secrets.SSH_USER }}
        #  TARGET: ${{ secrets.SSH_DIR }}
        #  SCRIPT_BEFORE: |
        #    systemctl stop resume
        #  SCRIPT_AFTER: |
        #    systemctl start resume