Speakeasy Logo
Skip to Content

Deploy from GitHub Actions

Overview

You can automate Gram deployments using GitHub Actions by setting up a workflow that runs the Gram CLI in your CI/CD pipeline.

This allows you to deploy changes automatically whenever you push to your repository.

Prerequisites

Before setting up GitHub Actions deployment, ensure you have:

  • A Gram Producer key
  • A repository with your OpenAPI specification or toolset configuration

Setup

1. Add API Key to Repository Secrets

  1. Go to your repository’s Settings > Secrets and variables > Actions
  2. Click New repository secret
  3. Name: GRAM_API_KEY
  4. Value: Your Producer API key
  5. Click Add secret

2. Create a deployment config

The deployment config will replace any existing Gram deployment in your project.

Config files can refer to local and remote files. Relative paths resolve from the config file’s directory.

Example:

3. Create GitHub Actions Workflow

Create .github/workflows/deploy.yml in your repository.

Force the deployment to be processed by passing a random value to --idempotency-key.

Workflow Customization

Deploy on Specific Branches

To deploy only from specific branches:

Add Validation Step

Include validation before deployment:

Troubleshooting

Authentication Errors

If you encounter authentication errors:

  1. Verify your GRAM_API_KEY secret is set correctly
  2. Ensure you’re using a Producer key, not a Consumer key

Last updated on