Skip to content

Commit

Permalink
Added kamal-path input
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-alexandrov committed Nov 25, 2024
1 parent ac01bc2 commit d463b11
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ This GitHub Action deploys your application using Kamal and handles cancellation
| `environment` | Optional deployment environment (e.g., `production`, `staging`). If omitted, the `--destination` flag is not passed. | No | None |
| `registry-username`| Registry Username (e.g., Digital Ocean Access Token) | Yes | |
| `registry-password`| Registry Password (e.g., Digital Ocean Access Token) | Yes | |

> **Note:** Only `registry-username` and `registry-password` are required. Any other necessary configuration, such as `DATABASE_URL`, `REDIS_URL`, and `RAILS_MASTER_KEY`, should be provided as environment variables in the workflow file.
| `kamal-path` | Path to the Kamal binary file. | No | `./bin/kamal` |

## Usage

> **Note:** Only `registry-username` and `registry-password` are required. Any other necessary configuration, such as `DATABASE_URL`, `REDIS_URL`, and `RAILS_MASTER_KEY`, should be provided as environment variables in the workflow file.
```yaml
steps:
- name: Kamal Deploy
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
registry-password:
description: 'Registry password'
required: true
kamal-path:
description: 'Path to the Kamal binary file'
required: false
default: './bin/kamal'
runs:
using: 'node20'
main: 'dist/index.js'
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ async function run() {
const environment = core.getInput('environment');
const registryUsername = core.getInput('registry-username', { required: true });
const registryPassword = core.getInput('registry-password', { required: true });
const kamalPath = core.getInput('kamal-path') || './bin/kamal';

core.exportVariable('KAMAL_REGISTRY_USERNAME', registryUsername);
core.exportVariable('KAMAL_REGISTRY_PASSWORD', registryPassword);
Expand All @@ -20,7 +21,7 @@ async function run() {
}

// Execute the deployment command
await exec.exec('./bin/kamal', deployCommand);
await exec.exec(kamalPath, deployCommand);

// Handle cancellation
process.on('SIGINT', async () => {
Expand All @@ -33,7 +34,7 @@ async function run() {
lockCommand.push(`--destination=${environment}`);
}

await exec.exec('./bin/kamal', lockCommand);
await exec.exec(kamalPath, lockCommand);
core.info('Kamal lock released successfully.');
} catch (error) {
core.setFailed(`Failed to release Kamal lock: ${error.message}`);
Expand Down

0 comments on commit d463b11

Please sign in to comment.