Skip to content

Commit

Permalink
Add deployer-binary input
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Oct 21, 2021
1 parent c9109f1 commit 732002f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 26 deletions.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,59 @@
## 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 '[email protected]'`.
# 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
```yaml
name: deploy

on: push

# It is important to specify "concurrency" for the workflow,
# to prevent concurrency between different deploys.
concurrency: production_environment

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
32 changes: 9 additions & 23 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,31 @@ inputs:

private-key:
required: true
description: >
Private key for connecting to remote hosts. To generate private key:
`ssh-keygen -o -t rsa -C '[email protected]'`.
description: The private key for connecting to remote hosts.

dep:
required: true
description: >
The deployer task to run. For example:
`deploy all`.
description: The command.

known-hosts:
required: false
default: ''
description: >
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`.
description: Content of `~/.ssh/known_hosts` file.

ssh-config:
required: false
default: ''
description: >
The SSH configuration. Content of `~/.ssh/config` file.
description: The SSH configuration

deployer-version:
required: false
default: ''
description: >
Deployer version to download from deployer.org.
First, the action will check for Deployer binary at those paths:
- `vendor/bin/dep`
- `deployer.phar`
description: Deployer version to download from deployer.org.

If the binary not found, phar version will be downloaded from
[deployer.org](https://deployer.org/download).
deployer-binary:
required: false
default: ''
description: Path to local Deployer binary.

runs:
using: 'node12'
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ async function ssh() {
}

async function dep() {
let dep
let dep = core.getInput('deployer-binary')

if (dep === '')
for (let c of ['vendor/bin/dep', 'deployer.phar']) {
if (fs.existsSync(c)) {
dep = c
Expand All @@ -51,7 +53,7 @@ async function dep() {
}
}

if (!dep) {
if (dep === '') {
let version = core.getInput('deployer-version')
if (version === '') {
console.log(`Downloading "https://deployer.org/deployer.phar".`)
Expand Down

0 comments on commit 732002f

Please sign in to comment.