【问题标题】:Github actions self-hosted cannot setup PHP 7.3自托管的 Github 操作无法设置 PHP 7.3
【发布时间】:2021-11-23 19:42:30
【问题描述】:

我有一个 deployment.yml 文件,用于通过 Github 操作在自托管的 ubuntu 服务器上部署 Laravel 应用程序,但不幸的是我遇到了这个错误

==> Setup PHP
✗ PHP Could not setup PHP 7.3
Error: The process '/bin/bash' failed with exit code 1

我该如何解决这个错误?

deployment.yml 文件

on:
  push:
    branches:
     - master

jobs:
  create-deployment-artifacts:
    name: create deployment artifacts
    runs-on: self-hosted

    steps:
    - uses: actions/checkout@v2

    - name: Configure PHP 7.3
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.3'
        tools: composer, phpunit
        extensions: mbstring,PDO,grpc,tokenizer,xml,json,ctype,fileinfo,openssl,bcmath

    - name: Install Dependencies
      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

    - name: Compile Assets
      run: |
         npm install
         npm run prod

    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.example', '.env');"

    - name: Generate key
      run: php artisan key:generate

    - name: Directory Permissions
      run: chmod -R 777 storage bootstrap/cache

【问题讨论】:

    标签: php laravel yaml github-actions


    【解决方案1】:

    请在setup-php步骤中将环境变量runner设置为self-hosted。

    文档:https://github.com/shivammathur/setup-php#self-hosted-setup

    - name: Configure PHP 7.3
      uses: shivammathur/setup-php@v2
      env:
        runner: self-hosted
      with:
        php-version: '7.3'
        tools: composer, phpunit
        extensions: mbstring,PDO,grpc,tokenizer,xml,json,ctype,fileinfo,openssl,bcmath
    

    如果仍然失败,请创建问题here。

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 2021-02-04
      • 2021-08-27
      • 2023-03-27
      • 2023-01-22
      • 2022-08-13
      • 2011-08-09
      • 2020-09-01
      • 2022-12-20
      相关资源
      最近更新 更多