This commit is contained in:
JoppeDC 2025-07-16 08:21:50 +02:00 committed by GitHub
commit 703868bf6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 7 deletions

View file

@ -18,7 +18,7 @@
# `deploy all`. # `deploy all`.
# Required. # Required.
dep: deploy dep: deploy
# The path to the PHP binary to use. # The path to the PHP binary to use.
# Optional. # Optional.
php-binary: "php" php-binary: "php"
@ -26,7 +26,7 @@
# Specifies a sub directory within the repository to deploy # Specifies a sub directory within the repository to deploy
# Optional # Optional
sub-directory: "..." sub-directory: "..."
# Config options for the Deployer. Same as the `-o` flag in the CLI. # Config options for the Deployer. Same as the `-o` flag in the CLI.
# Optional. # Optional.
options: options:
@ -50,13 +50,13 @@
# Optional. # Optional.
ssh-config: | ssh-config: |
... ...
# Option to skip over the SSH setup/configuration. # Option to skip over the SSH setup/configuration.
# Self-hosted runners don't need the SSH configuration or the SSH agent # Self-hosted runners don't need the SSH configuration or the SSH agent
# to be started. # to be started.
# Optional. # Optional.
skip-ssh-setup: false skip-ssh-setup: false
# Deployer version to download from deployer.org. # Deployer version to download from deployer.org.
# First, the action will check for Deployer binary at those paths: # First, the action will check for Deployer binary at those paths:
# - `vendor/bin/deployer.phar` # - `vendor/bin/deployer.phar`
@ -78,6 +78,10 @@
# You can specify the output verbosity level. # You can specify the output verbosity level.
# Optional. Defaults to -v. # Optional. Defaults to -v.
verbosity: -vvv verbosity: -vvv
# The branch to deploy. Adds --branch=value to the deploy command.
# Optional.
branch: "main"
``` ```
## Example ## Example

View file

@ -7,7 +7,7 @@ inputs:
dep: dep:
required: true required: true
description: The command. description: The command.
php-binary: php-binary:
required: false required: false
default: '' default: ''
@ -68,6 +68,11 @@ inputs:
default: '-v' default: '-v'
description: Verbosity level Can be -v, -vv or -vvv. description: Verbosity level Can be -v, -vv or -vvv.
branch:
required: false
default: ''
description: The branch to deploy.
runs: runs:
using: 'node20' using: 'node20'
main: 'index.js' main: 'index.js'

View file

@ -124,15 +124,18 @@ async function dep() {
} catch (e) { } catch (e) {
console.error('Invalid JSON in options') console.error('Invalid JSON in options')
} }
let phpBin = 'php' let phpBin = 'php'
let phpBinArg = core.getInput('php-binary'); let phpBinArg = core.getInput('php-binary');
if (phpBinArg !== '') { if (phpBinArg !== '') {
phpBin = phpBinArg phpBin = phpBinArg
} }
let branch = core.getInput('branch')
let branchOption = branch !== '' ? `--branch=${branch}` : ''
try { try {
await $`${phpBin} ${dep} ${cmd} ${recipe} --no-interaction ${ansi} ${verbosity} ${options}` await $`${phpBin} ${dep} ${cmd} ${recipe} --no-interaction ${ansi} ${verbosity} ${options} ${branchOption}`
} catch (err) { } catch (err) {
core.setFailed(`Failed: dep ${cmd}`) core.setFailed(`Failed: dep ${cmd}`)
} }