FTP-Deploy-Action icon indicating copy to clipboard operation
FTP-Deploy-Action copied to clipboard

Error when run composer in github action

Open paul-lestyo opened this issue 2 years ago • 1 comments

Bug Description When I try to add a command in my github action, I have some problems with it. composer try to get my .env (i think) in github, but i don't have it in repository. Do any have clue about this problem?

My Action Config

on:
  push:
    branches:
    - develop
name: 🚀 Deploy website on push develop
jobs:
  web-deploy:
    name: 🎉 Deploy
    runs-on: ubuntu-latest
    steps:
    - name: 🚚 Get latest code
      uses: actions/checkout@v2

    - name: 📂 Sync files
      uses: SamKirkland/[email protected]
      with:
        server: 185.237.145.36
        port: 65002
        username: ${{ secrets.ftp_username }}
        password: ${{ secrets.ftp_password }}
        server-dir: ./new_dev/
    - name: 🔨 Build Project
      run: |
        composer install
        php artisan key:generate
        php artisan passport:install
        php artisan storage:link

My Action Log

   > @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: kitloong/laravel-app-logger
Discovered Package: lab404/laravel-impersonate
Discovered Package: laravel/passport
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: laravolt/indonesia
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: rakutentech/laravel-request-docs
Discovered Package: spatie/laravel-http-logger
Discovered Package: spatie/laravel-permission
Package manifest generated successfully.
92 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

   ErrorException 

  file_get_contents(/home/runner/work/web-app/web-app/.env): Failed to open stream: No such file or directory

  at vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php:96
     92▕     {
     93▕         file_put_contents($this->laravel->environmentFilePath(), preg_replace(
     94▕             $this->keyReplacementPattern(),
     95▕             'APP_KEY='.$key,
  ➜  96▕             file_get_contents($this->laravel->environmentFilePath())
     97▕         ));
     98▕     }
     99▕ 
    100▕     /**

      +16 vendor frames 
  17  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
Error: Process completed with exit code 1.

paul-lestyo avatar Oct 19 '22 17:10 paul-lestyo

I think this is because git does not upload the .env to a GitHub repo.

so when you run php artisan key:generate, it wont be able to find .env to write the key to

justinkekeocha avatar Apr 27 '23 13:04 justinkekeocha