An open API service indexing awesome lists of open source software.

https://github.com/devuri/action-rd-ssh-update

Back up composer.lock file and update dependencies with logging.
https://github.com/devuri/action-rd-ssh-update

Last synced: 9 months ago
JSON representation

Back up composer.lock file and update dependencies with logging.

Awesome Lists containing this project

README

          

# Rd SSH Updates

Update Composer dependencies over SSH with logging and send a notification to Slack.

## Description

This GitHub Action allows you to update Composer dependencies on a remote server via SSH. It includes logging and notifies a Slack channel upon completion.

## Inputs

| Input | Description | Required | Default |
|-------------------|--------------------------------------|----------|----------|
| `web_app_path` | Path to the web application. | Yes | N/A |
| `ssh_host` | SSH host. | Yes | N/A |
| `ssh_username` | SSH username. | Yes | N/A |
| `ssh_private_key` | SSH private key. | Yes | N/A |
| `ssh_port` | SSH port. | Yes | N/A |
| `slack_webhook` | Slack Webhook URL. | Yes | N/A |
| `slack_channel` | The Slack channel for updates. | No | `general`|

## Usage

To use this action in your GitHub workflow, include a step that references this action and provides the necessary inputs.

### Example Workflow

```yaml
name: Update Website

on:
pull_request:
types:
- closed
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Runs at 00:00 UTC every Sunday

env:
WEB_APP_PATH: "/srv/users/myapp/apps/myapp"

jobs:
update:
name: "Update Web Application"
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Update and Backup Dependencies
uses: devuri/action-rd-ssh-update@main
with:
web_app_path: ${{ env.WEB_APP_PATH }}
ssh_host: ${{ secrets.SSH_HOST }}
ssh_username: ${{ secrets.SSH_USERNAME }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh_port: ${{ secrets.SSH_PORT }}
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
slack_channel: "general"
```

## Secrets

Ensure the following secrets are added to your repository settings:

- `SSH_HOST`
- `SSH_USERNAME`
- `SSH_PRIVATE_KEY`
- `SSH_PORT`
- `SLACK_WEBHOOK`

This action will perform the following steps:

1. Connect to the remote server via SSH.
2. Backup the `composer.lock` file.
3. Run `composer update` to update dependencies.
4. Log the update process.
5. Notify the specified Slack channel of the update status.

## License

The scripts and documentation in this project are released under the [MIT License](LICENSE)