Skip to content

Commit 732002f

Browse files
committed
Add deployer-binary input
1 parent c9109f1 commit 732002f

File tree

3 files changed

+62
-26
lines changed

3 files changed

+62
-26
lines changed

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,59 @@
1010
1111
## Inputs
1212
13-
See [action.yaml](action.yaml).
13+
```yaml
14+
- name: Deploy
15+
uses: deployphp/action@v1
16+
with:
17+
# Private key for connecting to remote hosts. To generate private key:
18+
# `ssh-keygen -o -t rsa -C 'action@deployer.org'`.
19+
# Required.
20+
private-key: ${{ secrets.PRIVATE_KEY }}
21+
22+
# The deployer task to run. For example:
23+
# `deploy all`.
24+
# Required.
25+
dep: deploy
26+
27+
# Content of `~/.ssh/known_hosts` file. The public SSH keys for a
28+
# host may be obtained using the utility `ssh-keyscan`.
29+
# For example: `ssh-keyscan deployer.org`.
30+
# If known-hosts omitted, `StrictHostKeyChecking no` will be added to
31+
# `ssh_config`.
32+
# Optional.
33+
known-hosts: |
34+
...
35+
36+
# The SSH configuration. Content of `~/.ssh/config` file.
37+
# Optional.
38+
ssh-config: |
39+
...
40+
41+
# Deployer version to download from deployer.org.
42+
# First, the action will check for Deployer binary at those paths:
43+
# - `vendor/bin/dep`
44+
# - `deployer.phar`
45+
# If the binary not found, phar version will be downloaded from
46+
# deployer.org.
47+
# Optional.
48+
deployer-version: "7.0.0"
49+
50+
# You can specify path to your local Deployer binary in the repo.
51+
# Optional.
52+
deployer-binary: "bin/dep"
53+
```
1454
1555
## Example
1656
1757
```yaml
58+
name: deploy
59+
60+
on: push
61+
62+
# It is important to specify "concurrency" for the workflow,
63+
# to prevent concurrency between different deploys.
64+
concurrency: production_environment
65+
1866
jobs:
1967
deploy:
2068
runs-on: ubuntu-latest

action.yaml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,31 @@ inputs:
66

77
private-key:
88
required: true
9-
description: >
10-
Private key for connecting to remote hosts. To generate private key:
11-
`ssh-keygen -o -t rsa -C 'action@deployer.org'`.
9+
description: The private key for connecting to remote hosts.
1210

1311
dep:
1412
required: true
15-
description: >
16-
The deployer task to run. For example:
17-
`deploy all`.
13+
description: The command.
1814

1915
known-hosts:
2016
required: false
2117
default: ''
22-
description: >
23-
Content of `~/.ssh/known_hosts` file. The public SSH keys for a
24-
host may be obtained using the utility `ssh-keyscan`. For example,
25-
`ssh-keyscan deployer.org`.
26-
27-
If known-hosts omitted, `StrictHostKeyChecking no` will be added to
28-
`ssh_config`.
18+
description: Content of `~/.ssh/known_hosts` file.
2919

3020
ssh-config:
3121
required: false
3222
default: ''
33-
description: >
34-
The SSH configuration. Content of `~/.ssh/config` file.
23+
description: The SSH configuration
3524

3625
deployer-version:
3726
required: false
3827
default: ''
39-
description: >
40-
Deployer version to download from deployer.org.
41-
42-
First, the action will check for Deployer binary at those paths:
43-
- `vendor/bin/dep`
44-
- `deployer.phar`
28+
description: Deployer version to download from deployer.org.
4529

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

4935
runs:
5036
using: 'node12'

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ async function ssh() {
4242
}
4343

4444
async function dep() {
45-
let dep
45+
let dep = core.getInput('deployer-binary')
46+
47+
if (dep === '')
4648
for (let c of ['vendor/bin/dep', 'deployer.phar']) {
4749
if (fs.existsSync(c)) {
4850
dep = c
@@ -51,7 +53,7 @@ async function dep() {
5153
}
5254
}
5355

54-
if (!dep) {
56+
if (dep === '') {
5557
let version = core.getInput('deployer-version')
5658
if (version === '') {
5759
console.log(`Downloading "https://deployer.org/deployer.phar".`)

0 commit comments

Comments
 (0)