Delivering deployments
Deliverybot works by triggering deployments via GitHub api’s. To actually ship those deployments your code responds to the deployment event and reads the provided parameters and deploys your code off to wherever it needs to go.
+-------------+ +--------+ +----------------+ +-------------+
| Deliverybot | | GitHub | | GitHub Actions | | Your Server |
+-------------+ +--------+ +----------------+ +-------------+
| | | |
| Create Deployment | | |
|--------------------->| | |
| | | |
| Deployment Created | | |
|<---------------------| | |
| | | |
| | Deployment Event | |
| |---------------------->| |
| | | SSH+Deploys |
| | |-------------------->|
| | | |
| | Deployment Status | |
| |<----------------------| |
| | | |
| | | Deploy Completed |
| | |>--------------------|
| | | |
| | Deployment Status | |
| |<----------------------| |
| | | |
You can view the workflow in the diagram above. The part we’re filling out right now is the ‘GitHub Actions’ component. We’re stubbing the behaviour to execute a deployment and mark it with the correct status.
Below is the example action that we can copy into
.github/workflows/deployment.yml
which listens to a GitHub deployment event
and then writes deployment status events depending on where the deployment ends
up.
# .github/workflows/deployment.yml
name: Deployment
on: ['deployment']
jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
- name: 'deployment pending'
uses: 'deliverybot/deployment-status@master'
with:
state: 'pending'
token: '${{ github.token }}'
- name: deploy
run: |
echo "environment - ${{ github.event.deployment.task }}"
echo "payload - ${{ github.event.deployment.payload }}"
- name: 'deployment success'
if: success()
uses: 'deliverybot/deployment-status@master'
with:
state: 'success'
token: '${{ github.token }}'
- name: 'deployment failure'
if: failure()
uses: 'deliverybot/deployment-status@master'
with:
state: 'failure'
token: '${{ github.token }}'
Compatible integrations
Follow the guides in these integrations below for implementing real deployments.