Github 操作部署失败,因为不匹配 composer-runtime-api ^2.0.0 但使用了 actions/checkout@v2
Github action deployment fails because of not matching composer-runtime-api ^2.0.0 but actions/checkout@v2 is used
Github 操作部署失败,因为不匹配 composer-runtime-api ^2.0.0
,即使 actions/checkout@v2
使用 composer
v2
laravel.yml:
name: Deploy to staging
on:
push:
branches: [ staging ]
jobs:
vapor:
name: Check out, build and deploy using Vapor
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ubient/laravel-vapor-action@master
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
with:
args: "deploy staging"
composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.4",
"aws/aws-sdk-php": "3.166.2",
"barryvdh/laravel-dompdf": "^0.8.7",
"bensampo/laravel-enum": "^3.2.0",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/helpers": "^1.3",
"laravel/sanctum": "^2.4",
"laravel/tinker": "^2.5",
"laravel/vapor-cli": "^1.12",
"laravel/vapor-core": "^2.8",
"laravel/vapor-ui": "^1.0",
"owen-it/laravel-auditing": "^10.0",
"pusher/pusher-php-server": "^4.1",
"sentry/sentry-laravel": "^2.3",
"spatie/laravel-permission": "^3.16",
"spatie/laravel-tags": "^2.7"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.8",
"beyondcode/laravel-dump-server": "^1.4",
"facade/ignition": "^2.5",
"fzaninotto/faker": "^1.9.1",
"laravel/horizon": "^5.6",
"laravel/sail": "^1.1",
"laravel/telescope": "^4.4.0",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-ide-helper",
"laravel/telescope"
]
}
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
},
"classmap": [
],
"files": [
"bootstrap/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"Illuminate\Foundation\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
错误:
Building project...
==> Validating Manifest File
==> Copying Application Files
==> Harmonizing Configuration Files
==> Setting Build Environment
==> Executing Build Commands
==> Running Command: composer install --no-dev
Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for jean85/pretty-package-versions 2.0.3 -> satisfiable by jean85/pretty-package-versions[2.0.3].
- jean85/pretty-package-versions 2.0.3 requires composer-runtime-api ^2.0.0 -> no matching package found.
Problem 2
- jean85/pretty-package-versions 2.0.3 requires composer-runtime-api ^2.0.0 -> no matching package found.
- sentry/sentry 3.2.0 requires jean85/pretty-package-versions ^1.5|^2.0.1 -> satisfiable by jean85/pretty-package-versions[2.0.3].
- Installation request for sentry/sentry 3.2.0 -> satisfiable by sentry/sentry[3.2.0].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
部署命令是'composer install --no-dev'
。起初,我在出现此错误时使用 actions/checkout@v1
,然后一旦我了解到 composer v2
在 checkout@v2
上而不是 v1
在 checkout@v1
,但问题仍然存在......欢迎任何关于为什么会发生这种情况的提示。
编辑:我能够运行从我的本地设备部署没有任何问题(一旦我移动到 composer v2)。
@bk2204 帮助我意识到我错误的假设,即 checkout@v2 将 composer 设置为 v2 我能够通过如下更改 laravel.yml
部署说明来解决我的问题:
name: Deploy to staging
on:
push:
branches: [ staging ]
jobs:
vapor:
name: Check out, build and deploy using Vapor
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP (w/ extensions) & Composer
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: pecl
extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo, tokenizer, xml, zip, pcntl
coverage: none
- name: Obtain Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Vapor CLI Globally
run: composer global require laravel/vapor-cli
- name: Install Composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-dev
- name: Deploy using Laravel Vapor
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
run: /home/runner/.composer/vendor/bin/vapor deploy staging
Github 操作部署失败,因为不匹配 composer-runtime-api ^2.0.0
,即使 actions/checkout@v2
使用 composer
v2
laravel.yml:
name: Deploy to staging
on:
push:
branches: [ staging ]
jobs:
vapor:
name: Check out, build and deploy using Vapor
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ubient/laravel-vapor-action@master
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
with:
args: "deploy staging"
composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.4",
"aws/aws-sdk-php": "3.166.2",
"barryvdh/laravel-dompdf": "^0.8.7",
"bensampo/laravel-enum": "^3.2.0",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/helpers": "^1.3",
"laravel/sanctum": "^2.4",
"laravel/tinker": "^2.5",
"laravel/vapor-cli": "^1.12",
"laravel/vapor-core": "^2.8",
"laravel/vapor-ui": "^1.0",
"owen-it/laravel-auditing": "^10.0",
"pusher/pusher-php-server": "^4.1",
"sentry/sentry-laravel": "^2.3",
"spatie/laravel-permission": "^3.16",
"spatie/laravel-tags": "^2.7"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.8",
"beyondcode/laravel-dump-server": "^1.4",
"facade/ignition": "^2.5",
"fzaninotto/faker": "^1.9.1",
"laravel/horizon": "^5.6",
"laravel/sail": "^1.1",
"laravel/telescope": "^4.4.0",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-ide-helper",
"laravel/telescope"
]
}
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
},
"classmap": [
],
"files": [
"bootstrap/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"Illuminate\Foundation\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
错误:
Building project...
==> Validating Manifest File
==> Copying Application Files
==> Harmonizing Configuration Files
==> Setting Build Environment
==> Executing Build Commands
==> Running Command: composer install --no-dev
Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for jean85/pretty-package-versions 2.0.3 -> satisfiable by jean85/pretty-package-versions[2.0.3].
- jean85/pretty-package-versions 2.0.3 requires composer-runtime-api ^2.0.0 -> no matching package found.
Problem 2
- jean85/pretty-package-versions 2.0.3 requires composer-runtime-api ^2.0.0 -> no matching package found.
- sentry/sentry 3.2.0 requires jean85/pretty-package-versions ^1.5|^2.0.1 -> satisfiable by jean85/pretty-package-versions[2.0.3].
- Installation request for sentry/sentry 3.2.0 -> satisfiable by sentry/sentry[3.2.0].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
部署命令是'composer install --no-dev'
。起初,我在出现此错误时使用 actions/checkout@v1
,然后一旦我了解到 composer v2
在 checkout@v2
上而不是 v1
在 checkout@v1
,但问题仍然存在......欢迎任何关于为什么会发生这种情况的提示。
编辑:我能够运行从我的本地设备部署没有任何问题(一旦我移动到 composer v2)。
@bk2204 帮助我意识到我错误的假设,即 checkout@v2 将 composer 设置为 v2 我能够通过如下更改 laravel.yml
部署说明来解决我的问题:
name: Deploy to staging
on:
push:
branches: [ staging ]
jobs:
vapor:
name: Check out, build and deploy using Vapor
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP (w/ extensions) & Composer
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: pecl
extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo, tokenizer, xml, zip, pcntl
coverage: none
- name: Obtain Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Vapor CLI Globally
run: composer global require laravel/vapor-cli
- name: Install Composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-dev
- name: Deploy using Laravel Vapor
env:
VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}
run: /home/runner/.composer/vendor/bin/vapor deploy staging