Add deployer-binary input

This commit is contained in:
Anton Medvedev 2021-10-21 22:08:17 +02:00
parent c9109f14cf
commit 732002f64c
3 changed files with 62 additions and 26 deletions

@ -10,11 +10,59 @@
## Inputs ## Inputs
See [action.yaml](action.yaml). ```yaml
- name: Deploy
uses: deployphp/action@v1
with:
# Private key for connecting to remote hosts. To generate private key:
# `ssh-keygen -o -t rsa -C 'action@deployer.org'`.
# Required.
private-key: ${{ secrets.PRIVATE_KEY }}
# The deployer task to run. For example:
# `deploy all`.
# Required.
dep: deploy
# Content of `~/.ssh/known_hosts` file. The public SSH keys for a
# host may be obtained using the utility `ssh-keyscan`.
# For example: `ssh-keyscan deployer.org`.
# If known-hosts omitted, `StrictHostKeyChecking no` will be added to
# `ssh_config`.
# Optional.
known-hosts: |
...
# The SSH configuration. Content of `~/.ssh/config` file.
# Optional.
ssh-config: |
...
# Deployer version to download from deployer.org.
# First, the action will check for Deployer binary at those paths:
# - `vendor/bin/dep`
# - `deployer.phar`
# If the binary not found, phar version will be downloaded from
# deployer.org.
# Optional.
deployer-version: "7.0.0"
# You can specify path to your local Deployer binary in the repo.
# Optional.
deployer-binary: "bin/dep"
```
## Example ## Example
```yaml ```yaml
name: deploy
on: push
# It is important to specify "concurrency" for the workflow,
# to prevent concurrency between different deploys.
concurrency: production_environment
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest

@ -6,45 +6,31 @@ inputs:
private-key: private-key:
required: true required: true
description: > description: The private key for connecting to remote hosts.
Private key for connecting to remote hosts. To generate private key:
`ssh-keygen -o -t rsa -C 'action@deployer.org'`.
dep: dep:
required: true required: true
description: > description: The command.
The deployer task to run. For example:
`deploy all`.
known-hosts: known-hosts:
required: false required: false
default: '' default: ''
description: > description: Content of `~/.ssh/known_hosts` file.
Content of `~/.ssh/known_hosts` file. The public SSH keys for a
host may be obtained using the utility `ssh-keyscan`. For example,
`ssh-keyscan deployer.org`.
If known-hosts omitted, `StrictHostKeyChecking no` will be added to
`ssh_config`.
ssh-config: ssh-config:
required: false required: false
default: '' default: ''
description: > description: The SSH configuration
The SSH configuration. Content of `~/.ssh/config` file.
deployer-version: deployer-version:
required: false required: false
default: '' default: ''
description: > description: 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: deployer-binary:
- `vendor/bin/dep` required: false
- `deployer.phar` default: ''
description: Path to local Deployer binary.
If the binary not found, phar version will be downloaded from
[deployer.org](https://deployer.org/download).
runs: runs:
using: 'node12' using: 'node12'

@ -42,7 +42,9 @@ async function ssh() {
} }
async function dep() { async function dep() {
let dep let dep = core.getInput('deployer-binary')
if (dep === '')
for (let c of ['vendor/bin/dep', 'deployer.phar']) { for (let c of ['vendor/bin/dep', 'deployer.phar']) {
if (fs.existsSync(c)) { if (fs.existsSync(c)) {
dep = c dep = c
@ -51,7 +53,7 @@ async function dep() {
} }
} }
if (!dep) { if (dep === '') {
let version = core.getInput('deployer-version') let version = core.getInput('deployer-version')
if (version === '') { if (version === '') {
console.log(`Downloading "https://deployer.org/deployer.phar".`) console.log(`Downloading "https://deployer.org/deployer.phar".`)