diff --git a/README.md b/README.md index 9121a79..d7cbf0b 100644 --- a/README.md +++ b/README.md @@ -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 '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 ```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 diff --git a/action.yaml b/action.yaml index d75655e..7168981 100644 --- a/action.yaml +++ b/action.yaml @@ -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 'action@deployer.org'`. + 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. + description: 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](https://deployer.org/download). + deployer-binary: + required: false + default: '' + description: Path to local Deployer binary. runs: using: 'node12' diff --git a/index.js b/index.js index 5dc0415..f2be226 100644 --- a/index.js +++ b/index.js @@ -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 @@ -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".`)