deployphp / action

GitHub Action for Deployer
MIT License
227 stars 46 forks source link

Command failed with ENOENT: deployer.phar #4

Open lcharette opened 3 years ago

lcharette commented 3 years ago

I get this error :

Error: Command failed with ENOENT: deployer.phar deploy prod -f .github/deploy.php
spawnSync deployer.phar ENOENT

More verbose error message would be welcomed.

deploy.yml :

name: Deploy to Production

on:
  push:
    branches:
      - 'master'

jobs:
  deploy:
    name: Deploy code to prod
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 7.4
    - name: Deploy
      uses: deployphp/action@master
      with:
        private-key: ${{ secrets.PRIVATE_KEY }}
        known-hosts: ${{ secrets.KNOWN_HOSTS }}
        dep: deploy prod -f .github/deploy.php

Upvote & Fund

Fund with Polar

antonmedv commented 3 years ago

Hmmmmm, can tell what is wrong.

neidiom commented 3 years ago

@lcharette @antonmedv any ideas on how to fix this?

antonmedv commented 3 years ago

It should be fixed in new release. Please test it.

neidiom commented 3 years ago

@antonmedv does not work for me, getting the following error

Error: Command failed with ENOENT: deployer.phar deploy test -v
spawnSync deployer.phar ENOENT
antonmedv commented 3 years ago

Now such file? Does any knows how to debug it?

neidiom commented 3 years ago

@antonmedv if I add deployer with composer with the command below then it works. Any idea how to debug?

composer require deployer/deployer --dev
taqie commented 3 years ago

@antonmedv I had a similar problem. I think this bug is caused by the fact that if deployer.phar does not exist then you download it but do not give it permission to execute

https://github.com/deployphp/action/pull/9

dingo-d commented 3 years ago

I'm also getting similar error when trying to use the action

  with:
    private-key: ***
    dep: deploy *** *** *** staging -v
(node:2511) UnhandledPromiseRejectionWarning: Error: spawn deployer.phar ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:2511) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2511) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My GH action looks like this

name: Deploy

on:
  # Run on pushes to `staging` branch only.
  push:
    paths-ignore:
      - '**.md'
    branches:
      - staging
      - '!main'
  # Allow manually triggering the workflow. Used for production deploy
  workflow_dispatch:

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        php: [7.4]
        node: [12.x]

    steps:
      - name: Checkout the repo
        uses: actions/checkout@v2

      - name: PHP setup
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: none
          tools: composer:v2, deployer, wp-cli

      - name: Use Node.js ${{ matrix.node }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}

      - name: Deploy to staging
        if: ${{ github.ref == 'refs/heads/staging' }}
        uses: deployphp/action@master
        with:
          private-key: ${{ secrets.STAGING_KEY }}
          dep: deploy ${{ secrets.ADMIN_USER }} ${{ secrets.ADMIN_EMAIL }} ${{ secrets.ADMIN_PASSWORD }} staging -v

      - name: Deploy to production
        if: ${{ github.ref == 'refs/heads/main' }}
        uses: deployphp/action@master
        with:
          private-key: ${{ secrets.PRODUCTION_KEY }}
          dep: deploy ${{ secrets.ADMIN_USER }} ${{ secrets.ADMIN_EMAIL }} ${{ secrets.ADMIN_PASSWORD }} production
JustChapman commented 3 years ago

@neidiom can you give an example of how you are running composer require deployer/deployer --dev? I cannot seem to get this to work, still running into the "failed with ENOENT" errors.

zivan commented 2 years ago

I had the same problem, created fork and opened pull request, you can check it https://github.com/zivan/action