https://github.com/ptah-sh/deploy-action
A GitHub CI/CD action to ease the deployment of services via ptah.sh
https://github.com/ptah-sh/deploy-action
fair-source self-hosted
Last synced: 5 months ago
JSON representation
A GitHub CI/CD action to ease the deployment of services via ptah.sh
- Host: GitHub
- URL: https://github.com/ptah-sh/deploy-action
- Owner: ptah-sh
- License: other
- Created: 2024-08-14T13:37:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T18:38:49.000Z (over 1 year ago)
- Last Synced: 2024-10-20T04:14:51.054Z (over 1 year ago)
- Topics: fair-source, self-hosted
- Language: JavaScript
- Homepage: https://ptah.sh
- Size: 267 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Deploy Service to Ptah.sh
This GitHub Action launches a new deployment to the Docker Swarm cluster managed by Ptah.sh.
## Inputs
### `apiKey`
**Required** The API Key for authentication with Ptah.sh.
### `service`
**Required** The slug of the service to deploy.
### `processes`
**Required** A YAML array containing process configurations for the deployment.
### `serverAddress`
**Optional** Custom server address. Default is "https://ctl.ptah.sh".
## Outputs
### `deploymentId`
The ID of the initiated deployment.
## Example Usage
```yaml
name: Deploy to Ptah.sh
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build -t my-service:${{ github.sha }} .
- name: Push Docker image
run: docker push my-service:${{ github.sha }}
- name: Deploy to Ptah.sh
uses: ptah-sh/deploy-action@v1
with:
apiKey: ${{ secrets.PTAH_API_KEY }}
service: 'my-service-slug'
processes: |
- name: svc
workers:
- name: main
dockerImage: my-service:${{ github.sha }}
envVars:
- name: SENTRY_VERSION
value: ${{ github.sha }}
id: deploy
- name: Get the deployment ID
run: echo "The deployment ID is ${{ steps.deploy.outputs.deploymentId }}"
```
## Process Configuration
The `processes` input should be a YAML array where each item represents a process to be deployed. Each process can have the following properties:
- `name` (required): The name of the process.
- `workers` (optional): An array of worker configurations. Each worker should have a `name` and a `dockerImage` (optional).
- `envVars` (optional): An array of environment variables for the process. Each environment variable should have a `name` and a `value`.
## Error Handling
The action will fail if:
- The input YAML for processes is invalid.
- The processes array is empty.
- Any process doesn't meet the validation criteria.
- The API call to Ptah.sh fails.
When the action fails, it will output an error message describing the problem.
## Development
To test the action locally, you can use the following command:
```bash
INPUT_PROCESSES=$(cat <