Skip to main content

Github Action

The Shipbot.io GitHub Action allows you to easily track deployments directly from your GitHub Actions workflow. Action can be found here.

Artifact Configuration

Within your artifact directory you can create a shipbot.json file to configure the artifact and retain it's ID.

{
"artifactId": 7
}

This should then be passed to the action using the artifactConfig parameter.

Inputs

ParameterRequiredDescription
apiKeyShipbot API key (found in Settings).
artifactConfigPath to service configuration JSON file containing artifactId
versionThe version can be any string.
environmentThis should match the environment created in Current Version. By default PRODUCTION is created.
commitShaCommit SHA reference.
userThe user initiating the deployment. Will be linked to Slack users within Shipbot.io once the user has logged into Shipbot.io and connected with Github.
branchThe branch that is being deployed.
statusOne of STARTED, SUCCEEDED, FAILED.
changelogThis can be a URL to a change log or the changelog notes itself.
descriptionThis can be further information on the deployment that wouldn't be considered part of the changelog.
linkThis should link to an external place where more action on the deployment can take place for example it could be the deployment job in your CI/CD pipeline.
typeThis is a enum describing the deployment strategy. The only option right now is SIMPLE.
logLevelLog level (DEBUG, INFO, WARNING, ERROR).

Example usage

GitHub secrets

Github secrets assumed to be set:

  • SHIPBOT_API_KEY - Shipbot.io API key found in Settings.

The examples below use a number of default GitHub environment variables which greatly enhance the quality of notifications and experience within Shipbot.io

From the below add the two jobs to your relevant Github workflow file.

name: Deploy Lambda Functions

# Trigger the workflow on changes to the 'functions/' directory
on:
push:
branches:
- main

# Define jobs
jobs:
deploy-code:
name: Deploy Code
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3

# Log deployment
- name: Log Deployment
uses: Shipbotio/shipbot-deployment-action@v1
with:
apiKey: ${{ secrets.SHIPBOT_API_KEY }}
artifactConfig: shipbot.json
environment: "PRODUCTION"
version: ${{ github.sha }}
commitSha: ${{ github.sha }}
branch: ${{ github.ref_name }}
link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
user: ${{ github.actor }}
status: "STARTED"

# Deploy Lambda function
- name: Deploy Code
run: |
echo "Deploying code."

- name: Mark deployment as succeeded
if: always()
uses: Shipbotio/shipbot-deployment-action@v1
with:
apiKey: ${{ secrets.SHIPBOT_API_KEY }}
deploymentId: ${{ steps.log_deployment.outputs.deploymentId }}
status: ${{ job.status == 'success' && 'SUCCEEDED' || 'FAILED' }}

If you wish to just track successful deployments you can omit the status parameter.

      - name: Log Deployment
uses: Shipbotio/shipbot-deployment-action@v1
with:
apiKey: ${{ secrets.SHIPBOT_API_KEY }}
artifactConfig: shipbot.json
environment: "PRODUCTION"
version: ${{ github.sha }}
commitSha: ${{ github.sha }}
branch: ${{ github.ref_name }}
link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
user: ${{ github.actor }}

Versioning

This action follows semantic versioning. You can:

  • Use a specific version: uses: Shipbotio/shipbot-deployment-action@v1.0.1
  • Use the latest version of a major release: uses: Shipbotio/shipbot-deployment-action@v1
  • Use the latest version (not recommended): uses: Shipbotio/shipbot-deployment-action@master