deployment-action

Action to create GitHub Deployment to receive notifications from external deployment tool

APACHE-2.0 License

Stars
5
Committers
2

deployment-action ts

This is an action to create a GitHub Deployment. It is designed to work with an external deployment system, such as Jenkins, Spinnaker or Argo CD.

Getting Started

To create a deployment:

jobs:
  deploy:
    steps:
      - uses: actions/checkout@v3
      - uses: int128/deployment-action@v1
        id: deployment

      # Trigger a deploy on your system
      - run: ./deploy.sh
        env:
          DEPLOYMENT_URL: ${{ steps.deployment.outputs.url }}

This action infers the environment name as follows:

  • On a pull request, the environment name is generated from the number like pr-123
  • On push of a branch, the environment name is the branch name like main
  • On push of a tag, the environment name is the tag name like tags/v1.0.0
  • Otherwise, the environment name is pair of workflow name and event name, like workflow/schedule

For example, when this action runs on a pull request, it creates a deployment like:

You can explicitly set the environment name by the input.

This action deletes all deployments of the environment name before creation. It keeps the timeline of pull request clean.

For monorepo

If your repository has multiple applications, you can add a suffix to environment. For example,

name: frontend

jobs:
  deploy:
    steps:
      - uses: int128/deployment-action@v1
        with:
          environment-suffix: /frontend
---
name: api

jobs:
  deploy:
    steps:
      - uses: int128/deployment-action@v1
        with:
          environment-suffix: /api

When this action runs on a pull request event, it creates a deployment like:

Inputs

Name Default Description
environment (inferred from event) Environment name
environment-suffix (optional) Suffix of environment name
description (optional) Description of environment
task (optional) Task name of environment
token github.token GitHub token

Outputs

Name Description
url Deployment URL
id Deployment ID (for REST)
node-id Deployment ID (for GraphQL)
Package Rankings
Top 17.68% on Github actions
Badges
Extracted from project README
ts
Related Projects