This GitHub Action (written in JavaScript) wraps the GitHub Deployment API, specifically the Create a deployment status endpoint, to allow you to leverage GitHub Actions to create deployment status.
Create a workflow .yml file in your repository's .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.
For more information on these inputs, see the API Documentation
deployment_id: The ID of the Deployment.state: The state of the status. Can be one oferror,failure,inactive,in_progress,queued,pending, orsuccess.environment_url: Sets the URL for accessing your environment.
For more information on these outputs, see the API Documentation for an example of what these outputs look like
id: The deployment status ID
On every push to a tag matching the pattern v*, create a deployment:
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Deployment
jobs:
build:
name: Create Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Deployment
id: create_deployment
uses: alexcnichols/create-deployment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
environment: production
# Run the actual deployment
- name: Create Deployment Status
id: create_deployment_status
uses: alexcnichols/create-deployment-status@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
deployment_id: ${{ steps.create_deployment.outputs.id }}
state: success
environment_url: https://alexcnichols.devThis will create a Deployment Status. This uses the GITHUB_TOKEN provided by the virtual environment, so no new token is needed.
We would love you to contribute to @alexcnichols/create-deployment-status, pull requests are welcome! Please see the CONTRIBUTING.md for more information.
The scripts and documentation in this project are released under the MIT License.